You just made a function called onTouched and you never gave it anything to connect to so it could run. You need to connect it to an event.
function onTouched(part)
script.parent.value.value = script.parent.value.value + 1
end
script.Parent.Touched:connect(onTouched)
Also, you don't need to name it "onTouched". As long as the function names match then it will know what function to trigger when it is ".Touched" |