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

I need my GUI to open when a player joins or opens GUI, but not when they die. How?

I've received complaints from my players about the welcome GUI being annoying as it pops up when you respawn, not just when you join the game or click the open introduction button. I have tried my best but not succeeded in getting my script to make the GUI open at these times.

Here is the code I started off with:

local frame = script.Parent.Parent.IntroGUI
local open = false

script.Parent.MouseButton1Click:Connect(function()
	if frame.Visible == false then
	frame.Visible = true
	end
end)

This is the script I have now, and this does the same as the one before, only more lengthy. This was an attempt to make is so that the problem is fixed, however it has not worked.

local frame = script.Parent.Parent.IntroGUI
local open = false

if game.Players.PlayerAdded == true then
	frame.Visible = true
elseif script.Parent.MouseButton1Click then
	script.Parent.MouseButton1Click:Connect(function()
		if frame.Visible == false then
			frame.Visible = true
		end
	end)
	else
		frame.Visible = false
end

This is my GUI tree:
file:///Users/adam/Desktop/Screenshot%202020-05-01%20at%2011.24.59.png

And this is my GUI:
file:///Users/adam/Desktop/Screenshot%202020-05-01%20at%2011.25.40.png

This is the script for my GUI close button:

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Visible = false
end)

Hope someone can help!

1 comment

0

Because you have player added in your script, the method I showed you won't work, as scripts override what you set the properties to in the Studio if you have the script change the properties.

1 answer

✓ Accepted answer

It's actually easier than you think. There is a property for every GUI called "ResetOnSpawn". Just go to it in Properties for your GUI and set it to false. Then it will not show up when a player respawns.

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