local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local hum = character:WaitForChild("Humanoid")
local humroot = character:WaitForChild("HumanoidRootPart")
local function raycast()
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {character}
local raycastOrigin = humroot.Position
local raycastDirection = humroot.CFrame.LookVector * 1.25
local raycastHit = workspace:Raycast(raycastOrigin, raycastDirection, raycastParams)
if raycastHit then
if hum:GetState() == Enum.HumanoidStateType.Freefall then
hum:ChangeState(Enum.HumanoidStateType.Jumping)
end
end
end
uis.JumpRequest:Connect(raycast)
I’m trying to make a script where if a player jumps and a wall is detected infront of them then they can jump again, this works fine but how can I make it so that the player actually has to press spacebar/jump again for it to jump? Right now, it just does it for the player after they jump once and holding spacebar/jump also does it. I can’t do Enum.HumanoidStateType.Landed because it interferes with another double jump that I have.
yo bro, is this from apex legends? But i have a working version here it is: local uis = game:GetService(“UserInputService”)
local plr = game.Players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local hum = character:WaitForChild(“Humanoid”)
local humroot = character:WaitForChild(“HumanoidRootPart”)
local bodVelocity = nil
local deb = false
local function raycast()
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {character}
local raycastOrigin = humroot.Position
local raycastDirection = humroot.CFrame.LookVector * 1.25
local raycastHit = workspace:Raycast(raycastOrigin, raycastDirection, raycastParams)
local playerLookVector = humroot.CFrame.LookVector
local backwardVelocity = -playerLookVector
if raycastHit then
if hum:GetState() == Enum.HumanoidStateType.Freefall then
if hum:GetState() == Enum.HumanoidStateType.Landed then return end
if hum:GetState() == Enum.HumanoidStateType.Running then return end
if not deb then
deb = true
hum:ChangeState(Enum.HumanoidStateType.Jumping)
bodVelocity = Instance.new("BodyVelocity", humroot)
bodVelocity.Velocity = backwardVelocity * 50
wait(0.2)
bodVelocity:Destroy()
wait(1)
deb = false
end
end
end