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

How do I get my script to find the new humanoid after a player has died?

Asked by
Txeer 46
4 years ago
Edited 4 years ago

When a player dies I have a script set their walkspeed and jumppower to 0 and make a GUI visible. It works the 1st time they die but never after that. I was told this could be solved by adding a CharacterAdded function so it would always find the current humanoid but that just broke the script entirely. This is a LocalScript if that helps any.

The code segment:

    hum.Died:Connect(function()
        wait(5)

        storage.RemoteEvents.MobileOff:FireServer()

        repeat wait() 
        looky.CameraType = Enum.CameraType.Scriptable
        until looky.CameraType == Enum.CameraType.Scriptable

        repeat wait()
        looky.CFrame = game.Workspace.startingcamerapos.CFrame
        until looky.CFrame == game.Workspace.startingcamerapos.CFrame

        script.Parent.Visible = true
    end)

Answer this question