Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

What's wrong with this script?

local player = game.Players.LocalPlayer
	player.CharacterAdded:connect(function(char)
humanoid = player.Character:WaitForChild("Humanoid")
	if humanoid.Jump == true then
		player:LoadCharacter()
	end
	end)

I put this in a LocalScript. It's supposed to check if you're able to jump, and if you are, to reload your character. Dunno if this is the right way to do it, but it doesn't seem to work for some reason.

2 answers

✓ Accepted answer

Try using Changed instead of CharacterAdded. Changed is useful for seeing if there is a change within the property of an object.

local player = game.Players.LocalPlayer
humanoid = player.Character:WaitForChild("Humanoid")
humanoid.Changed:connect(function(property)
    if property == "Jump" and humanoid.Jump == true then
        player:LoadCharacter()
    end
end)

Maybe u need to loop it re-do the script but make it local in the player backpack

Like this

While wait() do local player = game.Players.LocalPlayer

humanoid = player.Character:FindFirstChild("Humanoid")

if humanoid.Jump == true then

    player:LoadCharacter()

end

end)

Or if u don't want that use this

local player = game.Players.LocalPlayer ---This wrong theres no local player in game.Player yet when player enters game so do this

game.Players.PlayerAdded:connect(function(player)

Wait(2) --- waits for the player to spawn

humanoid = player.Character:FindFirstChild("Humanoid") --- finds the player humanoid

if humanoid.Jump == true then

    player:LoadCharacter()

end

end)

I did it , it works try it u will see

This discussion is preserved as it was. New answers, comments, and votes are closed.