Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Gui script help?

Asked by
steev 0
9 years ago

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
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. PropheticExtinction 75 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago
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

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.) Spongocardo 1991 — 9y
0
Also, you need to set the copy's parent to Player.Backpack, not Player.StarterGui. Merely 2122 — 9y
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 PropheticExtinction 75 — 9y
1
No, that is incorrect. Backpack is for GEAR, while PlayerGui is for GUIs. Therefore, you must do player.PlayerGui. Perci1 4988 — 9y
Ad

Answer this question