I have made a timer and when it hits 0 i want it to give the player coins, i know how to give stats after a certain amount of time but only when its in the same script as the leaderstat it’s a separate script.
text = game.StarterGui.ScreenGui.Frame.TextLabel
while true do
text.Text = 10
wait(1)
text.Text = 9
wait(1)
text.Text = 8
wait(1)
text.Text = 7
wait(1)
text.Text = 6
wait(1)
text.Text = 5
wait(1)
text.Text = 4
wait(1)
text.Text = 3
wait(1)
text.Text = 2
wait(1)
text.Text = 1
wait(1)
text.Text = 0
game.StarterGui.ScreenGui.Frame.TextLabel.TextColor3 =Color3.fromRGB(70, 255, 49)
game.StarterGui.money.moneyframe.moneytext.Transparency = 0
Here is where cash should. be given
wait(3)
game.StarterGui.money.moneyframe.moneytext.Transparency = 1
game.StarterGui.ScreenGui.Frame.TextLabel.TextColor3 =Color3.fromRGB(0, 0, 0)
end
You could make a global variable for the timer, and with that, you can access to that ‘timer’ from any script. [Dont forget to update the timer, in one script is enough, but make sure the sever can see it]
local Player = game.Players.LocalPlayer
local Gui = Player:WaitForChild("PlayerGui"):WaitForChild("YourGuiNameHere")
if Player and Gui then
if text.Text == 0 then
Player:WaitForChild("leaderstats").Coins.Value += 1
end
Gui.Frame.TextLabel.TextColor3 = Color3.fromRGB(70, 255, 49)
Gui.Frame.TextLabel.Visible = false
task.Wait(3)
Gui.Frame.TextLabel.Visible = true
--rest of the code
end
local plr = game.Players.LocalPlayer
text = plr.PlayerGui.ScreenGui.Frame.TextLabel
while true do
for i=10,0,-1 do
text.Text = i
wait(1)
end
plr.PlayerGui.ScreenGui.Frame.TextLabel.TextColor3 =Color3.fromRGB(70, 255, 49)
plr.PlayerGui.money.moneyframe.moneytext.Transparency = 0
plr.leaderstats.Cash.Value += 100 -- change cash with ur value and 100 with ur number
wait(3)
plr.PlayerGui.money.moneyframe.moneytext.Transparency = 1
plr.PlayerGui.ScreenGui.Frame.TextLabel.TextColor3 =Color3.fromRGB(0, 0, 0)
end
No need to be rude lol, She was simply telling you to not use wait() as it’s a older system, the task.wait has alot of new library’s / task implementation’s added to it,
Apparently you don’t “Bud” not if you are still using “wait()” Might wanna do your research looks like you don’t even know the difference I think you need to look into it some more
[P.S] Here is a link to give you some information you need: task