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

A part that gives a GUI even after the player resets?

I have a morph base and I use a script to apply both the morph and a GUI to the player when the part is touched. If the player were to reset, having used the morph or not, they will still get the morph's parts and appearance back, but not the GUI.

I use this script to give the GUI using debounce, and it does give the GUI, but only if the player has not reset during the active game.

local part = script.Parent

local debounce = false

part.Touched:Connect(function(hit)
	if not debounce then
		debounce = true
		
		local ptt = game.Players:playerFromCharacter(hit.Parent)
		if ptt == nil then return end 
		local wfp = script.Parent:findFirstChild("ScreenGui"):clone()
		if wfp == nil then return end 
		wfp.Parent = ptt.PlayerGui

		wait(0.5)
		
		debounce = false
	end
end)

Players testing this have had to rejoin and, in some cases, have the server shut down as the script still wouldn't work after rejoining the active server.

1 comment

0

You could try setting the Gui's property, "ResetOnSpawn" to false.

2 answers

✓ Accepted answer

Hello,

To make a GUI stay after a players death, we can use a property of ScreenGui called ResetOnSpawn. Here's how we'd use it.

(Assuming that the localscript's parent was the ScreenGui.)

ScreenGui = script.Parent
ScreenGui.ResetOnSpawn = false

That's all, it makes sure that everything inside the ScreenGui will stay after the character respawns or dies.

1 comment

0

Huge thanks to both you and Stephenthefox, I feel incredibly stupid not thinking about this before. Again though, thank you!

You can set the ScreenGui's property, "ResetOnSpawn" to false.

When the game ends and you want to remove the gui, you can hook up a remote event and a local script(to delete it)

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