More explanation

What I’m doing is when the frog dies, it sends a message to the controller script this way;
msg.post(“controller#script”, “reset”)
msg.post(“controller#script”, “resetscore”

Reset message is sent so the frog resets when it dies, and the score reset is so the score resets, instead of starting over once a coin is collected. like so;

if message_id == hash(“resetscore”) then
self.score = 0
msg.post(“hud”, “set_score”, { score = 0 })

    --lives
 --   elseif message_id == hash("lives") then
--    self.life = self.life - message.reset
--    msg.post("hud", "set_lives", { life = self.life })

the Hud part of the code is;

–lives test
elseif message_id == hash(“set_lives”) then
local l = gui.get_node(“life”)
gui.set_text(l, message.life)
–end lives test
set_lives(self, message.lives)
end