Why my messages are not working

function init(self)
    msg.post("ground/controller#script", "set_speed", { speed = self.speed })
end
function on_message(self, message_id, message, sender)
	if message_id == hash("stop") then
		msg.post("ground/controller#script", "set_speed", { speed = message.speed })
	end
end

It is my controller script. When my hero eats the obkect with the script below< my ground should stop(it’s speed has to be 0), but it is not working

	self.speed = - 300
end	
function update(self, dt)
    local pos = go.get_position()
    pos.x = pos.x + self.speed * dt
    go.set_position(pos)
    if pos.x == -32 then
    	go.delete()
    end
end
function on_message(self, message_id, message, sender)
	if message_id == hash("contact_point_response") then
		if message.group == hash('hero') then
			msg.post("level/controller#script", "stop")
			go.delete()
		end
	end
end

Could you please describe this a bit more? I’m having a hard time following what is supposed to happen. Some comments:

In the init() function you call msg.post("ground/controller#script", "set_speed", { speed = self.speed }). This looks fine I think.

But in on_message() when you handle the “stop” message you call msg.post("ground/controller#script", "set_speed", { speed = message.speed }) with speed set to message.speed, but when you post the stop message (msg.post("level/controller#script", "stop")) you don’t include any speed in the message.

I fixed it< but it’s not working. I made controller for control such things as speed and death of the hero for resetting the game. Such thing was used in the first tutorial.

So it’s working now? Or is it still broken? Can you please post the relevant scripts so we can take a look?