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

How do I get a gui to not reappear into the startergui after someone clicks the play button?

Asked by 10 years ago

Hey, I am really new to scripting so I made this gui that destroys itself after someone press the play button but it keeps coming back once the player dies here is the script

Player = game.Players.LocalPlayer
Menu = script.Parent
Play = Menu.Play


function PlayDaGame()
        Menu:Remove()
        wait(1)
    end


Play.MouseButton1Down:connect(PlayDaGame)

1 answer

Log in to vote
2
Answered by
Perci1 4988 Trusted Moderation Voter Community Moderator
10 years ago

Set the Visible property of the GUI to false, thus making it invisible. Then, when a player joins the game, set the Visible property to true. Since the PlayerAdded event fires when a player enters, and not each time they respawn, it will not show up if a player respawns.

In a script in workspace, try this:

game.Players.PlayerAdded:connect(function(plr)
    wait(3) --Helps prevent glitching
    plr.PlayerGui.ScreenGui.Menu.Visible = true --This path might not be correct, replace it with whatever you have.
end)
0
Thanks! MrN00bReaper 30 — 10y
Ad

Answer this question