Trouble firing all clients and passing information

So I have a simple remote event from script to local script to change some gui text.

the server script code is:

game.ReplicatedStorage.ChangeGui:FireAllClients("Map has Loaded. Teleporting Players.")

And the local script code is


game.ReplicatedStorage.ChangeGui.OnClientEvent:Connect(function(text)
	print(text)
	print(tostring(text))
end)
game.ReplicatedStorage.ChangeGui.OnClientEvent:Connect(SetText)

when running this code it just returns nil it wont give me the string I put in the server script why?

Weird, how about try removing the SetText() connected function and only let the script to print the text.

whats weirder is I run this code multiple times it works all the other times except for this one

Have you tried this in a real game? Because studio can be very buggy.

I found what I think is the issue. When the event fires, the player isn’t loaded. By changing your script to the following, I got it to work first try.

Server Script:

game.ReplicatedStorage.playerReady.OnServerEvent:Connect(function(player) --new remote event
	game.ReplicatedStorage.ChangeGui:FireAllClients("Map has Loaded. Teleporting Players.")
end)

Local Script:

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local hum = character:WaitForChild("Humanoid")

game.ReplicatedStorage.playerReady:FireServer() --Fires the RE when the player is fully done loading

game.ReplicatedStorage.ChangeGui.OnClientEvent:Connect(function(text)
	print(text)
	print(tostring(text))
end)

The reason it worked after your first try was because the player was fully loaded (I believe).

thats a good theory but I found out the error it was with team create not committing scripts so im gonna make it in a local place then figure out why it wont work

Sounds good, glad you figured it out.