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

[SOLVED] Why dosen't my LocalScript code run? (disable jump script)

LocalScript

wait(2)
game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0

thats all. like this is simply to disable jumping, but somehow it dosent work, dosent error, but if i paste this line of code in the shell it works.

game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0

seems like it never runs.

3 answers

Create a normal script inside StarterPlayer > StarterCharacterScripts and paste this.

-- the reason why we put in StarterCharacterScripts is because it will only run if the player spawns/respawns

local character = script.Parent -- everything inside StarterCharacterScripts will be moved to the player's character when he/she joins the game, then the scripts will run. this one should get the character of the player when you join the game

local humanoid = character:FindFirstChildOfClass("Humanoid") -- FindFirstChildOfClass gets the child of an instance that is the same class as what is written in the argument which is "Humanoid"

humanoid.JumpPower = 0
humanoid.JumpHeight = 0
humanoid:SetSateEnabled(Enum.HumanoidStateType.Jumping, false) -- disables jumping

If you want explanations of the script, read the comments in the script.

You don't have to use a script for this, all you need to do is go to StarterPlayer and scroll down until you see CharacterUseJumpPower, then uncheck that

1 comment

0

^ You'd also have to lower JumpHeight to 0 if you uncheck that, or JumpPower if it is checked.

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