Im attempting to make a brick that when touched will identify what number toucher you were. Specifically, when someone touches the brick, it should detect how many times its been touched, and put that number in a numbervalue inside of the character. So the first person to touch it should get a value of one, second should get 2, so on so fourth.
I made the script:
local touches = script.Parent.touches.Value -- number value counting the times its been touched
function onTouched(hit)
if hit.Parent:findFirstChild("Humanoid") then
touches = touches + 1 -- add a number to touches
wait(1)
hit.Parent.pednum.num.Value = touches -- update the characters number
end
end
script.Parent.Touched:connect(onTouched)
However, when touching the brick, the "touches" value does not increase at all, and the players "pednum" value goes up by a random amount. I'm not even sure where to go about this. Im running a test server for this in edit mode.
