Hello! I made a currency system but it doesnt work, Nothing came in the output so heres the scripts.
leaderstats
game.Players.PlayerAdded:Connect(function(plr)
local f = Instance.new("Folder", plr)
f.Name = "leaderstats"
local noobcoins = Instance.new("IntValue", f)
noobcoins.Name = "Noob Coins"
noobcoins.Value = 0
end)
Collect Coin Script (CollectScript)
WaitTime = 60 -- How many seconds to respawn the coin!
Amount = 1 -- Amount of coins per coin!
function onTouched(part)
local h = part.Parent:findFirstChild("Humanoid")
if (h~=nil) then
local thisplr = game.Players:FindFirstChild(h.Parent.Name)
if (thisplr~=nil) then
local stats = thisplr:findFirstChild("leaderstats")
if (stats~=nil) then
local Score = stats:findFirstChild("Noob Coins")
if (Score~=nil) then
Score.Value = Score.Value + Amount
end
end
end
script.Parent.Transparency = 1
script.Disabled = true
wait(WaitTime)
script.Parent.Transparency = 0
script.Disabled = false
end
end
Explorer >>>>