Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I need help making a ontouch script for my simulator called fishing simulator. Can anybody help?

I am making a game called fishing simulator and i need help with my first event. I don't know how to make it to where the player who touched the object gets more coins.

 function onTouched(hit)
 
end
    script.Parent.Touched:connect(onTouched)

The Coins directory thing is in players game.Players.guyman123["???? Coins"] I hope that was understandable.

1 answer

✓ Accepted answer
script.Parent.Touched:Connect(function(hit)
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
plr["Coins"].Value = plr["Coins"].Value + 1 --here you need to change the value to how many coins player will get.
end)

Hope this helped.

This discussion is preserved as it was. New answers, comments, and votes are closed.