Player not detecting a collision

I have made a spike and when the player hits it i want the player script to print out spike detected. But i belive there is a problem with the collision objects masks because every time my player hits a spike nothing happens. Does anyone know what could be causing this?

Screenshots showing the collision object for the player and spike:


code which should run when the contact is made

local group_spike = hash("spike")
function on_message(self, message_id, message, sender)
	if message_id == group_spike then
		print("spike detected")
	end
end

Will the message_id really be “spike”? I suggest you pprint(message) and print(message_id) to find out what you are receiving (if anything).

sounds like a good idea, i did this and it showed me that no message had been made so i assume that there is a problem with the collision groups. Not sure what it could be yet tho :slight_smile:

Have a look here:

1 Like

I think i will just delete the collision group and try again tomorrow probs just a problem with how i set up the collision group, thanks tho