How can I make a leap/super jump ability?

I thought if I did that the player wouldn’t forcefully jump, sorry

2 Likes

No need to be sorry, but that is something I would surly test. Seems to me it is just what you’re looking for.

3 Likes

@2112Jay is right. If you have the player`s humanoid on the Server, you can just do:

local hum = plr.Character:WaitForChild("Humanoid")
hum.Jump = true

So you take your UIS part, and when true, you fire a RemoteEvent to the Server which fires this code

2 Likes

I used a LocalScript in StarterPlayerScripts to make the leaping ability, so do I need to rewrite the entire script from scratch, or I can reuse my current script and just modify it?

Edit: I misread the last part of your message by accident, woops…

2 Likes

Update: it works, the player now jumps and moves forward when leaping and looking forward, thanks guys!

2 Likes

Have to go to StarterPlayer and set CharacterUseJumpPower to true. Alt is messing with the interface so I went LeftControl. And we can skip the combo keys here by just using the jump key as is.

--local script
local player=game:GetService("Players").LocalPlayer
local humanoid=player.Character:WaitForChild("Humanoid")
local uis=game:GetService("UserInputService")

uis.InputBegan:Connect(function(input)
	if input.KeyCode==Enum.KeyCode.LeftControl then
		humanoid.JumpPower=120 
	end
end)

uis.InputEnded:Connect(function(input)
	if input.KeyCode==Enum.KeyCode.LeftControl then
		humanoid.JumpPower=50
	end
end)

Basically you hold down LeftControl and you get more jump power.

3 Likes

Lol, I just scripted it rq for you. Well if you still need it:
LOCAL SCRIPT:

local player = game.Players.LocalPlayer
local userInputService = game:GetService("UserInputService")
local rep = game:GetService("ReplicatedStorage").RemoteEvent

local cooldownTime = 1
local onCooldown = false
local altPressed = false
local zPressed = false

local function startCooldown()
	onCooldown = true
	rep:FireServer()
	wait(cooldownTime)
	onCooldown = false
end

userInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		altPressed = true
	elseif input.KeyCode == Enum.KeyCode.Z and not onCooldown then
		zPressed = true
		startCooldown()
	end
end)

userInputService.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftControl then
		altPressed = false
	elseif input.KeyCode == Enum.KeyCode.Z then
		zPressed = false
	end
end)

SERVER SCRIPT:

local rep = game:GetService("ReplicatedStorage").RemoteEvent

rep.OnServerEvent:Connect(function(plr)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local hum = char.Humanoid
	hum.JumpHeight += 100
	hum.Jump = true
end)

Now you only need to add an RemoteEvent in ReplicatedStorage and itll work
EDIT: I also used LeftControl

3 Likes

But will it replicate to the server?

2 Likes

Semi-unrelated question, but the LocalScript that I made, will it show the player actually leap on everyone else’s ends or will it only be on the end of the person who has leaped?

2 Likes

my version will be shown to every player and the server, which is why I made a RemoteEvent. But Im not too sure about your solution

1 Like

I tested with another person, and they said that it showed me leap, but just incase I will use your version xd, thanks again btw

2 Likes

Also, also, one more thing: Do I need to name the RemoteEvent anything specific?

1 Like

You just have to keep it “RemoteEvent”

2 Likes

But it is using combo keys … meaning that is the only combination that will work. So you can’t super jump if you are also pushing forward or any other direction. Go test it … that changed my mind quickly about combo keys. :rofl:

1 Like

I meant like, looking forward, and the player leaping that direction.

I tested it and it still worked.

1 Like

I ran it and that’s a nice set up. However it is not super jumping.
Love how you went to LeftControl too… lol, saw the same problem I take it.

1 Like

hmm… It super jumped for me, albeit I am trying to restore the function where the player also gets pushed forward when looking forward, and only jumps up if looking up like in the older LocalScript

1 Like

You’re definitely on to that forcing the jump in script should give you the control to do all that.
I’m not going to post a re-wright of your script. I think you got this covered if you add the rest to it.

1 Like

Yeah, I already restored that function, no worries.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.