local db = true script.Parent.Touched:connect(function(hit) if hit.Name == "pickuparea" then game.Players:FindFirstChild("Humanoid") if db == true then db = false script.Parent.Transparency = 1 local player = script.Parent.Touched player.leaderstats.Robux.Value = player.leaderstats.Robux.Value + 10 script.Parent.Sound:Play() script.Parent.Transparency = 1 wait(60) db = true script.Parent.Transparency = 0 end end end)
I need the script to detect the player that is using the tool, so that the player can be rewarded with currency. I need help ASAP and it will be greatly appreciated
Edit :
From what I understand, you want the part of the tool, in this case the "handle", to touch the object and the player earn an amount of money.
So that's it here :
script.Parent.Touched:Connect(function(hit) if hit.Parent.Name == "Tool" then local findplayer = game.Players:FindFirstChild(hit.Parent.Parent.Name) if findplayer ~= nil then findplayer.leaderstats.Robux.Value = findplayer.leaderstats.Robux.Value + 1 end end end)