I'm trying to make a coin collect script. Any help?
script.Parent.Touched:Connect(function(hit)
local humanoid = hit:findFirstChild("Humanoid")
if humanoid ~= nil then
game.Players:GetPlayerFromCharacter(hit.Parent).leaderstats.Coins.Value = game.Players:GetPlayerFromCharacter(hit.Parent).leaderstats.Coins.Value + 1
script.Parent.Transparency = 1
script.Parent.CollectSound:Play()
wait(script.Parent.CollectSound.TimeLength)
script.Parent:Destroy()
end
end)
