script for coin:
local delay = false
game.Players.PlayerAdded:Connect(function(player)
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
if delay == false then
---------------------------------
player.leaderstats.coins.Value += 2
---------------------------------
delay = true
script.Parent.Position -= Vector3.new(0,5,0)
wait(6)
script.Parent.Position += Vector3.new(0,5,0)
delay = false
end
end
end)
end)
script for leaderboard:
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Parent = player
leaderstats.Name = "leaderstats"
local coins = Instance.new("IntValue")
coins.Parent = leaderstats
coins.Value = 0
coins.Name = "coins"
end)