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

Why is the time on my GUI different for every player? (Deeper explanation inside)

Asked by 10 years ago

Information Below I have these these two timer GUIs, now working, but my problem is, is that the time is different for every player. I am trying to make the time global, and stay the same for every player throughout the server. In example:



time = 30 for i = 1, 30 do wait(1) time = time - 1 script.Parent.Text = tostring(time) end script.Parent.Text = "Commencing Purge." --[[ It used to have local before the time, so I removed that, but it is still different for every player. How do I make it the same time server-wide ]]--

Thanks!

EDIT: That was confusing, basically, Every time a player dies, or joins the game, the time starts over on whichever GUI is active, what I am having trouble with, is the time staying the same throughout player death and joining, basically, The same time for the whole server. Thanks again!

1 answer

Log in to vote
0
Answered by
lomo0987 250 Moderation Voter
10 years ago

What you currently have is that it's a script inside a player. What you can do is put a value inside workspace and have it connect to that and have a main script that changes the time on that value.. (This isn't the best way to do it but it's one that I like to do as you can edit it fairly easily.)

Here is the script that will change the time, you can edit it if you know what you are doing or if you need more help just comment below and i will provide more details.

local time = game.Workspace:FindFirstChild("Time") -- time needs to be an IntValue inside workspace.

for i = 1, 30 do
wait(1)
i = i - 1
end

Here is the script that should be inside the player.. Above should be in a script inside the workspace. It can be anywhere for that script..

local time = game.Workspace:FindFirstChild("Time")

time.changed:Connect(function(TimeChange)
script.Parent.Text = time.Value
end)

This way you can edit it fairly easily. Again, the first script goes into workspace and the 2nd script is a local script inside the StarterGUI. (Can be a normal? I duno)

0
I have two GUIs though. Think of it like this. What I am trying to do is: I start out with One GUI disabled, Ill call it PT, and anothener GUI that starts out enabled called WT. WT is enabled, so it runs for 30 seconds, then it disables, and then PT ables. PT lasts for 45 seconds, then disables, and WT is enabled again. So how would I make two different values for two different clocks, and how wo nightmare13542 45 — 10y
0
Can you make the model so I can look at it correctly and make it work for you? It will be easier to do it that way. lomo0987 250 — 10y
0
Sure! Thanks! One second. nightmare13542 45 — 10y
0
Okay, provide me with the link of the model when you made it a model. lomo0987 250 — 10y
View all comments (2 more)
Ad

Answer this question