I am trying to change the text of a TextLabel with a RemoteEvent. Strangely, the text does change - but only the second time the round() function below is called. Does anyone know why this is happening or how to fix it?
Here are the relevant scripts. I also have a RemoteEvent called ChangeBigText. The first is RunGame, in ServerScriptStorage:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("ChangeBigText") local function setup() [minigame code - shouldn't be relevant, but can add if needed] end local function round() remoteEvent:FireAllClients() [minigame code - shouldn't be relevant, but can add if needed] end setup() while true do round() end
The second is changeGUIscript, a LocalScript in StarterPlayerScripts
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("ChangeBigText") local player = game.Players.LocalPlayer local screenGUI = player.PlayerGui:WaitForChild("ScreenGui") local function changeGUI() print("test print") screenGUI.TextLabel.Text = "text change" end remoteEvent.OnClientEvent:Connect(changeGUI)
I've tried calling remoteEvent:FireAllClients() multiple times during round() and the text still only changes during the second call to round(), so it's definitely the second call to round() that lets the text change and not the second FireAllClients call. Any help would be much appreciated. Thank you for reading!