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

Why is this not working when the player dies?

Asked by 9 years ago

After the player presse's a button they will be in first person. But this code does not seem to be working.It is in a local script inside the players PlayerGui

Player = game.Players.LocalPlayer
Clicked = false
    local player = game.Players.LocalPlayer
    Cam = workspace.CurrentCamera -- Currently not in use

        Player.CharacterAdded:connect(function(character)
            character:WaitForChild("Humanoid").Died:connect(function()
                if Clicked then
                    character:WaitForChild("Humanoid") 
                    print("The player has died")
            Player.CameraMode = Enum.CameraMode.LockFirstPerson
            print(Clicked)

                end
            end)

    end)
game.workspace.Lobby.Log.PlayButton.SurfaceGui.ImageButton.MouseButton1Click:connect(function()
    Clicked = true
        Player.CameraMode = Enum.CameraMode.LockFirstPerson
        end)


0
Add a print statement after line 3 that the humanoid died, and add another print statement after line 4 to make sure Clicked is true. Merely 2122 — 9y
0
I did that,they both print out raspyjessie 117 — 9y
1
What isn't working? Is this all the code there is? We need more info. TheLuaWeaver 301 — 9y
0
it is not working because the player does not get the Fps when they die or reset raspyjessie 117 — 9y

Answer this question