Hello!, this is my first post so sorry for any mistakes, anyways i want this script to be a simple script to give the Player the ingame currency. Every time to the Player resets, the script would no longer start functioning with the error on the Title. I’ve tried multiple solutions but the same error would appear. Here’s the Script.
local debounce= false
local paper= script.Parent
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local Player = game.Players:GetPlayerFromCharacter(hit.Parent)
local leaderstats = Player.leaderstats
if debounce==false then
debounce=true
leaderstats.ToiletPaper.Value= Player.leaderstats.ToiletPaper.Value + 1
paper.Transparency= 1
paper.CanCollide= false
wait(5)
debounce= false
paper.Transparency= 0
paper.CanCollide= true
end
end
end)
Thanks for reading!