Hello! So, I'm making a coin system in my game (a game that simulates a race). I created a part of a coin and added a counter. But now I would like to make these coins (part) appear randomly through the race and keep moving (example: left, right, up and down), and I would also like to know how I save this information so that the player does not lose his money when he leaves the game
accountant script:
game.Players.PlayerAdded:Connect(function(plr)
local paste = Instance.new("Folder",plr)
paste.Name = 'leaderstats'
local money = Instance.new("IntValue",paste)
money.Name = 'money'
end)
coins(part) script:
local debounce = false
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild('Humanoid') then
if debounce == false then
debounce = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player.leaderstats.money.Value = player.leaderstats.money.Value + 1
script.Parent:Destroy()
end
end
end)

2 comments
interesting, now all we need to do is move the coin (from left to right and back and forth) alias, to save the information, do I just have to add this to a script on the serverScriptServer?
yes,It saids so,pls approve if this works