Hello, I am making a king of the hill game and I have this GUI that displays what is happening in the game like "Starting game" etc. When the player resets the Gui resets to the original Gui without the updated text.
I am using a local script with Filtering enabled. I am using remote events to get the variables from the values in serverScriptService
I've tried multiple times to fix this but none seem to fix it.
player.CharacterAdded:connect(function(character) --Fires when a char is added local playerName = game.Players.LocalPlayer.Name --Gets the local player name if character.Name == playerName then --Checks if it is the same player wait(3) --Waits for some time script.Parent.Text = textval2 --Sets the value script.Parent.Parent.Number.Text = startingInVal2 --Sets the value end end) --textval2 and startingInVal2 are global variables that I assigned in the functions that run when the values update
Any help is appreciated.
Most likely you have not enabled 'resetOnSpawn'. See, until the text updates again you will be left with the default text because it grabs the gui from StaterGui every time the player spawns. However, resetOnSpawn being disabled overrides that and just leaves the gui there.
Wiki: https://wiki.roblox.com/index.php?title=API:Class/LayerCollector/ResetOnSpawn
Simply enabling the property should solve your problem :)
(thanks to Horribilis_Aedrovulf's comment about it)