Hello again, I'm quite new to remote events and such, but for some reason I keep getting this error each time I go into play mode:
19:36:19.000 - Maximum event re-entrancy depth exceeded for RemoteEvent.OnClientEvent 19:36:19.000 - While entering function defined in script 'ServerScriptService.GameScript', line 30 19:36:19.001 - Players.PyccknnXakep.PlayerGui.Game.gameScript:12: bad argument #3 to 'Text' (string expected, got nil) 19:36:19.002 - Stack Begin
Here is (part of) the server script:
local ui1 = game.ReplicatedStorage.ui1 ui1.OnClientEvent:connect(function(player) ui1:FireAllClients("Game Over") end) local ui2 = game.ReplicatedStorage.ui2 ui2.OnClientEvent:connect(function(player) ui2:FireAllClients("Intermission") end) local ui3 = game.ReplicatedStorage.ui3 ui3.OnClientEvent:Connect(function(player) ui3:FireAllClients("Get Ready...") end) local ui4 = game.ReplicatedStorage.ui4 ui4.OnClientEvent:Connect(function(player) ui4:FireAllClients("Choosing Map...") end) ---------- while true do ui1:FireAllClients() --... ui2:FireAllClients() --... ui3:FireAllClients() --... ui4:FireAllClients() end ----------
And here is the local script in the StarterGui that changes the text:
local ui1 = game.ReplicatedStorage.ui1 ui1.OnClientEvent:connect(function(text1) main.time_left.Text = text1 end) local ui2 = game.ReplicatedStorage.ui2 ui2.OnClientEvent:connect(function(text2) main.time_left.time_header.Text = text2 end) local ui3 = game.ReplicatedStorage.ui3 ui3.OnClientEvent:connect(function(text3) main.time_left.time_header.Text = text3 end) local ui4 = game.ReplicatedStorage.ui4 ui4.OnClientEvent:connect(function(text4) main.time_left.time_header.Text = text4 end)
--...
Means that it's continuing on with the script, like I said that's part of the script.
I can't quite figure out why I'm getting an error. Any help appreciated though.
There's no wait on the while statement. You can use one RemoteEvent for this. You can't use OnClientEvent in a ServerScript, that's for the Local part. Another way to do this is to have the client track a value in ReplicatedStorage changed by a Server Script that displays Text based on the Changed event in a LocalScript.
ServerScript
local RemoteEvent = Instance.new("RemoteEvent") RemoteEvent.Name = 'display_text' RemoteEvent.Parent = game:GetService("ReplicatedStorage") local readyplayer1 = { 'Get ready'; 'Get set'; 'Get crunk'; 'Goooo!' } for i,v in pairs(readyplayer1) do RemoteEvent:FireAllClients(v) wait(1) end
LocalScript
local RemoteEvent =game:GetService("ReplicatedStorage"):WaitForChild("display_text") RemoteEvent.OnClientEvent:Connect(function(str) yourtextlabel.Text = str end)
The first error is because you are firing too many events at once. I think one reason may be because you forgot to put a wait() in your while loop, server script line 18. The second error about the text is apparently you are passing nil instead of a string.