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

Gui script help?

I have a script for a Gui and it works fine. But when the player respawns the gui pops up again and i don't want that. Is there any possible way? If so can anyone modify this script.

wait(1)

script.Parent.Main.Close.MouseButton1Down:connect(function()
script.Parent:remove()
end)

Thank you.

1 comment

1

Yes you can fix this by placing the gui into the Workspace and then have the gui clone itself to the players StarterGui on enter so that once they die it doesn't show back up again. If someone hasn't given you the code block by the time I finish school today then I will write it up for you.

1 answer

function onPlayerAdded(Player)
	Player:WaitForDataReady()
	copy = game.Workspace.NAMEofGUI:Clone() --Make sure the GUI is already set to be visible
	copy.Parent = Player.StarterGui
end

game.Players.PlayerAdded:connect(onPlayerAdded)

I haven't tested this I just wrote it up really fast. If it doesn't work I know I have one at home that I made that works that I will send you. Just tell me if you need it via a ROBLOX PM ~PropheticExtinction

4 comments

0

You should get rid of the WaitForDataReady() method on line 2. It doesn't work properly and causes the script to yield infinitely, waiting for the data to be ready. (At least that's what happened to me the last three times I tried to use it.)

0

Also, you need to set the copy's parent to Player.Backpack, not Player.StarterGui.

0

Yeah Player.Backpack, sorry my bad. I typed it up sitting in class so I wasn't focusing very much. I just gave him the model as well that I know works because I made it and used it in an old place of mine. Here it is: http://www.roblox.com/onEntered-GUI-item?id=178515664

1

No, that is incorrect. Backpack is for GEAR, while PlayerGui is for GUIs. Therefore, you must do player.PlayerGui.

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