How to make a Jump high system!
Baiscly you press L and you fling in the air or i guess force jump and you jump higher all the ones i see are just jumping high in general but how would you put this into an abiliy?
Why dont you just use humanoid.JumpPower?
well how would i make the player jump when they press L?
Use inputservice or contextactionservice or the new inputthing, here is inputservice:
use ApplyImpulse function on HumanoidRootPart, or just set jump property to true
local inputService = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local keybind = Enum.KeyCode.L
inputService.InputBegan:Connect(function(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode ~= keybind then return end
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid.Health =< 0 then return end
humanoid.Jump = true
end
your a good guy not a bad guy your the best guy but it doesnt work for some reason…
can you share me the output please
You didn’t close the connect properly and also it may be better if you set a jumppower
local inputService = game:GetService("UserInputService")
local players = game:GetService("Players")
local player = players.LocalPlayer
local keybind = Enum.KeyCode.L
inputService.InputBegan:Connect(function(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode ~= keybind then return end
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid.Health =< 0 then return end
humanoid.JumpPower = 150
humanoid.Jump = true
humanoid.JumpPower = 50
end)
Edit: @iuseselfnone make sure you put this in a local script inside startercharacterscripts
Ok fixed it:
Client:
local inputService = game:GetService("UserInputService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local player = players.LocalPlayer
local jumpEvent = replicatedStorage:WaitForChild("jumpEvent")
local keybind = Enum.KeyCode.L --Change here
inputService.InputBegan:Connect(function(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode ~= keybind then return end
jumpEvent:FireServer()
end)
Server:
local replicatedStorage = game:GetService("ReplicatedStorage")print("Hello world!")
local jumpEvent = replicatedStorage:WaitForChild("jumpEvent")
local jumpPower = 100 --Change here
jumpEvent.OnServerEvent:Connect(function(player)
local character = player.Character
if not character then return end
local humanoid = character:FindFirstChildOfClass("Humanoid")
if humanoid.Health <= 0 then return end
humanoid.UseJumpPower = true
humanoid.JumpPower = jumpPower
humanoid.Jump = true
local landed = false
local connection = humanoid.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Landed then
humanoid.UseJumpPower = false
humanoid.JumpPower = 50
end
end)
repeat task.wait() until landed
connection:Disconnect()
end)
create a remote event under replicatedstorage:
OR JUST USE THIS:
JumpDemo.rbxl (56.7 KB)
I also forget you have to set it on the server mb (and enable UseJumpPower)
Good job all of you you all are amazing people thanks for helping a fellow developer
No problem, glad I could help!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.