I'm using click detectors for my game but I need to find the player to give the player "candies" whenever he clicks the pumpkin and I don't know how to achieve this
Here's my script :
script.Parent.MouseClick:connect(function(hit)
local h = game.Players:findFirstChild(hit.Parent.Name)
h.Candy.Value = h.Candy.Value +5
end)

1 comment
Chili pretty much covers everything, though make sure that you are connecting the MouseClick to the ClickDetector in the Part, and not the actual Part.