Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

When player dies, Gui should update but doesn't? No errors?

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.

2 comments

0

Make sure the ScreenGui value "resetonSpawn" is set to false

0

Thank you!

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.