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

After death a new GUI appears?

Asked by
Bman8765 270 Moderation Voter
10 years ago

I have a main starting gui but I want to know, how would I code a separate localscript that basically makes it so when a player dies they are then greeted with a new GUI asking if they would like to return to checkpoint or not. I can handle the other stuff, I just need the code that makes it so the old gui doesn't open up again!

Here is the main GUI code:

Start = script.Parent.StartButton
CourseSelect = script.Parent.CourseSelect
target = game.Workspace.Cam
camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
angle = 0
go = 0
CourseSelect.Visible = false
Num = 0
Course1 = script.Parent.CourseSelect.Course1
Course2 = script.Parent.CourseSelect.Course2
Course3 = script.Parent.CourseSelect.Course3
Start.Visible = true
Course1.Visible = false
Course2.Visible = false
Course3.Visible = false
character = game.Players.LocalPlayer.Character
TwoD = game.Players.LocalPlayer.Character.Head
-- Size X 400, Size Y 300
started = false
print("Started = false")

function ClickedStart()
    if started == false then
    CourseSelect.Visible = true
    Start.Visible = false
    for GuiSize = 1, 45 do 
        if GuiSize <= 45 then
            CourseSelect.Size = CourseSelect.Size +UDim2.new(0.01, 0, 0.015, 0)
            Num = Num +1
            print(Num)
        end
     wait()
    end
    Course1.Visible = true
    Course2.Visible = true
    Course3.Visible = true
    end
end

function ClickedCourse1()
    started = true
    print("Started = true")
    Course1.Visible = false
    Course2.Visible = false
    Course3.Visible = false
    CourseSelect.Visible = false
    character:MoveTo(workspace.Course1Tele.Position)
end

Start.MouseButton1Down:connect(ClickedStart) -- Here
Course1.MouseButton1Down:connect(ClickedCourse1)

Any help would be great like wiki links or just the code in general, yes I noticed the tip of the day but I can't seem to get it to work how I want it to.

0
Have you tried using Died, then WaitForChild to wait for the player to spawn, then showing the GUI? wrenzh 65 — 10y

Answer this question