Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make this timer script the same time for all players instead of local?{Still Unsolved}

Asked by 10 years ago

Basically, I need to script to be a timer script that's the same for everyone, not local. I'm currently experiencing problems that whenever I reset/die, the time resets back to its full time. How would I make it so the time is the same for all the players, would I create a IntValue or something?... Script Below

time=0
while true do
wait()
time=time+30
for i=1, 30 do
    time=time-1
    wait(1)
    for i, player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.TimerSet.Frame.Time.Text=tostring(time) 
end
end

time=time+45
for i=1, 45 do
    time=time-1
    wait(1)
    for i, player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.TimerSet.Frame.Time.Text=tostring(time)
end
end
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.Humanoid.Health = 0
player.Character.Humanoid.MaxHealth = 0
end
end

Thanks!

0
I've been in this situation before. Set the 'time' variable to an IntValue in Workspace, and work your magic from there. Shawnyg 4330 — 10y
0
Trial and error time. ;-; Time to screw it all up! :D nightmare13542 45 — 10y
0
Yeah, I can't do this. ;-; nightmare13542 45 — 10y
0
Shouldn't it work if I put this at the top of the script? time = game.Workspace:FindFirstChild("TimerValue").Value nightmare13542 45 — 10y
0
yep. Check out my answer. Shawnyg 4330 — 10y

1 answer

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago
t=game.Workspace.Timer.Value
while true do
wait()
t=t+30
for i=1, 30 do
    t=t-1
    wait(1)
    for i, player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.TimerSet.Frame.Time.Text=tostring(t) 
end
end

t=t+45
for i=1, 45 do
    t=t-1
    wait(1)
    for i, player in pairs(game.Players:GetPlayers()) do
    player.PlayerGui.TimerSet.Frame.Time.Text=tostring(t)
end
end
for i, player in pairs(game.Players:GetPlayers()) do
player.Character.Humanoid.Health = 0
player.Character.Humanoid.MaxHealth = 0
end
end


0
Still no. The Value doesn't change throughout the whole time, and if I reset so does the timer. ;-; nightmare13542 45 — 10y
0
Is this in Workspace? Shawnyg 4330 — 10y
0
Yes, it is. nightmare13542 45 — 10y
Ad

Answer this question