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

FireAllClient Firing at the exact same time?

Asked by
tjtorin 172
5 years ago

I am trying to make something that changes the text of a label for all players at the same time and I am using FireAllClients and I have 2 of them but they run at the exact same time and it just shows the second text and not the first.

Script 1

script.Parent.Event:Connect(function(plr)
    changeNotifier:FireAllClients("Selecting Map...",3)
    local map = pickMap()
    changeNotifier:FireAllClients("Map Selected: "..map,3)
end)

Script 2

changeNotifier.OnClientEvent:Connect(function(text,dur)
    n.Text = text
    wait(dur)
    n.Text = ""
end)
0
wait() DinozCreates 1070 — 5y
0
I did that and it did not show the second text tjtorin 172 — 5y
0
then you did it wrong. DinozCreates 1070 — 5y

1 answer

Log in to vote
2
Answered by 5 years ago

You shouldn't make the clients wait, that stops the second event from coming because they were busy waiting. Instead, make the server wait in between sending events. Like this:

script.Parent.Event:Connect(function(plr)
    changeNotifier:FireAllClients("Selecting Map...")
    local map = pickMap()
    wait(3)
    changeNotifier:FireAllClients("Map Selected: "..map)
end)
0
This answer is good, but doesn't explain correctly what is wrong. The issue is that you are immediately firing again to say what the map is right when the "Loading map..." was posted before. You need to wait the duration that you are sending before sending again, or else the first one will never seem like it happened because they both fire at the exact same time,  causing the second one's text to Vmena 87 — 5y
Ad

Answer this question