UIS = game:GetService('UserInputService') UIS.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.Space then game.Players.LocalPlayer.Character.Humanoid.Jump = false print'you cant jump boi' end end)
It prints but it does not prevent jumping at all. Ive also tried setting HumanoidStateType to None but that doesen't work either. Could someone fill me in on how i'm supposed to prevent jumping properly?
Checking UserInputService will tell you when the player jumps AFTER he jumped, thus not preventing it.
What you should do (and I believe that's what's being done everywhere) is using a function fired with Humanoid.Changed, and every time the Humanoid changes, set Jump to false.
Should look like this:
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char:FindFirstChild("Humanoid").Changed:connect(function() char.Humanoid.Jump=false end) end) end)
Didn't test it but I think it should work.
__
If you want it inside a LocalScript,
local plr=script.Parent.Parent local hum=plr.Character:FindFirstChild("Humanoid") hum.Changed:connect(function() hum.Jump=false end)
Just put that inside a LocalScript inside StarterGui/StarterPack