Change something on a Gui that resets on spawn without turning off ResetOnSpawn

Is it possible to change something on a Gui that resets on spawn without turning off ResetOnSpawn?

Let me elaborate…

My team change Gui is basically built off of reset on spawn, so when a player dies, it pops back up. If I were to script it so it doesn’t reset on spawn I’d basically have to re-script everything and I’d be a huge pain.

But I’ve run into an issue, I’m trying to make it so an aspect of the Gui changes. This change was simple when someone hit a brick It would allow them a different team option on the GUI, but when the player resets (due to ResetOnSpawn) It disappears. Is there ANY good way to combat this without re-scripting everything?

Thanks.

2 Likes

Just add a CharacterAdded event somewhere, and whenever the player resets, that even will fire. And since you don’t want to rescript everything, you can put that Gui as a child to the script (or anywhere that’s not PlayerGui/StarterGui) then clone that gui to the PlayerGui while destroying the previous one.

1 Like

Tried option 1 and 2 already. (CharacterAdded & Cloning)

Option 1 didn’t work for whatever reason, I’m guessing because I just did it wrong, and reverted back to what it used to be. I’ll try it again.

Option 2 just broke my game for some reason. Guessing because there’s over-lapping scripts or something? Not 100% sure, but it was a headache.

Then it’s better to rescript everything. Sometimes rewriting code can help you further understand and maybe improve on previous scripts. I’ve done this many time before and I reassure you that this isn’t a bad idea.

1 more thing.

My code is not working. I’ve tried to Tween the Position back to Its original position and it keeps multiplying the position and moving in random places. I also have tried using a regular old Frame.Position code, which isn’t moving the frame at all. Not sure what the issue is here. But It’s really a pain.

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		if player.PlayerGui:FindFirstChild("Menu") then
			player.PlayerGui.Menu.Frame.Visible = true
			player.PlayerGui.Menu.Frame:TweenPosition(UDim2.new(0, 0, 0, 0),"InOut","Sine",0.5)
		end
		if not player.PlayerGui:FindFirstChild("Menu") then
			local Clone = script.Menu:Clone()
			Clone.Parent = player.PlayerGui
			Clone.Frame.Visible = true
		end
	end)
end)