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

Why can't I use a script to make the player jump?

Asked by 5 years ago
Edited 5 years ago

I could've swore this would work in the past. Even manually clicking the button for jump in Humanoid.Jump doesn't make me jump.

uis.InputBegan:connect(function(input,process) 
if not process and input.KeyCode == Enum.KeyCode.B then
          player.Character.Humanoid.Jump = true 
end
end)
0
did you try to use a remoteevent ? (im not the humanoid expert) jdm4llfem8 94 — 5y
0
No, I didn't think I would have to. I can change walkspeed no problem with a localscript. Edbotikx 99 — 5y
0
Okay i found the problem. You have to make it jump with an RemoteEvent. How do i know? I tested it by test playing, and i set the jump to true in the client, it didnt do anything. Then i went to the server and then made jump true, and it did work. jdm4llfem8 94 — 5y
0
if this is a localscript this should work? Imperialy 149 — 5y
View all comments (2 more)
0
nvm Imperialy 149 — 5y
0
use a remoteevent and see if that worked jdm4llfem8 94 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

I had a problem recently where setting Humanoid.Jump to true worked in studio but not in game servers, but using Humanoid:SetStateEnabled() worked the other way around. Try this:

local UIS = game:GetService("UserInputService")
local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()

UIS.InputBegan:Connect(function(key,gameProc)
   if not gameProc then
      if key.KeyCode == Enum.KeyCode.B then
         char.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping,true)
      end
   end
end)
0
you may have to edit this a bit, because using this method might force the player to continuously jump. im not sure though Gey4Jesus69 2705 — 5y
0
Please fix your naming conventions, thanks. Customality 21 — 5y
Ad

Answer this question