Hello there. This system is meant to be that when you step on it, it gives you a GUI that counts down and when it reaches 0, it gives you the money then deletes it self. This works while playing alone, however... when there's another player in the server, it gets stuck at 14 on the countdown, until the other player steps on the pad as well. Then it continues to countdown, until it reaches 1. It gives the money but doesn't delete the GUI, like it does solo.
Layout: http://prntscr.com/bvajfp
Main Script:
time = 15
while true do
wait(1)
time = time - 1
if (time == 0) then
time = 15
players = game.Players:GetChildren()
for i=1, #players do
if (players[i]:findFirstChild("leaderstats")) then
players[i].leaderstats.Money.Value = players[i].leaderstats.Money.Value + 30000
script.Parent:Destroy()
end
end
end
playersa = game.Players:GetChildren()
for i=1, #playersa do
playersa[i].PlayerGui.FlashGUI.text.Text = "You will recieve the money in: " .. tostring(time)
end
end
GUI Giver script, located in head:
local debounce = false
function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if (human ~= nil) and debounce == false then
debounce = true
local player = getPlayer(human)
if (player == nil) then return end
script.Parent.Parent:findFirstChild("FlashGUI"):clone().Parent = player.PlayerGui
wait(5)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)

4 comments
Is this the proper change? http://prntscr.com/bvorsd If so, it doesn't work and gives this error message: http://prntscr.com/bvos7d
Change the players[i] to playersa[i]
Changed, its now doing this. https://gyazo.com/ffe999cfa77bf5067b051cfb0e8c5867
I have edited the answer to fix that.