So, this wall running script I made was working really well. However, when I logged in & tested it again, the jump boost (JumpPower), isn’t working. It’s supposed to give the player a jump boost as soon as the player stopped wall running. I tried going back to the previous versions, but nothing worked. Please help!
local Speed = 2500
local Gravity = 25
local JumpPower = 70
local MaxWallrunRadius = 4
local CameraTiltAmount = 15
local Cooldown = 0
local char = script.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
local HRP = char:WaitForChild("HumanoidRootPart")
local hum = char:WaitForChild("Humanoid")
-- Create an Animator and parent it to the Humanoid
local animator = Instance.new("Animator")
animator.Parent = hum
-- Create animations for wall run
local wallRunLeftAnimation = Instance.new("Animation")
wallRunLeftAnimation.AnimationId = "rbxassetid://71374977318025"
local wallRunLeftAnimTrack = animator:LoadAnimation(wallRunLeftAnimation)
local wallRunRightAnimation = Instance.new("Animation")
wallRunRightAnimation.AnimationId = "rbxassetid://118584492588701"
local wallRunRightAnimTrack = animator:LoadAnimation(wallRunRightAnimation)
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {char}
local Attach = Instance.new("Attachment")
Attach.Parent = HRP
local Velocity = Instance.new("LinearVelocity")
Velocity.Parent = HRP
Velocity.MaxForce = math.huge
Velocity.Enabled = false
Velocity.Attachment0 = Attach
local Signal = script.Parent:WaitForChild("WallrunSignal")
local RS = game:GetService("RunService")
local Wallrunning = false
local WallrunningNormal = Vector3.new(0, 0, 0)
local lastWallrun = 0
local isRightAnimationPlaying = false
local isLeftAnimationPlaying = false
Signal.OnServerEvent:Connect(function(plr, val)
if hum:GetState() ~= Enum.HumanoidStateType.Freefall then return end
if val then
if tick() - lastWallrun < Cooldown then return end
lastWallrun = tick()
local right = workspace:Raycast(HRP.Position, HRP.CFrame.RightVector * MaxWallrunRadius, params)
if right and right.Instance then
Wallrunning = 1
WallrunningNormal = Vector3.new(right.Normal.Z, 0, -right.Normal.X)
Signal:FireClient(plr, CameraTiltAmount)
if not wallRunRightAnimTrack.IsPlaying and not isRightAnimationPlaying then
wallRunRightAnimTrack:Play()
wallRunLeftAnimTrack:Stop()
isRightAnimationPlaying = true
end
else
local left = workspace:Raycast(HRP.Position, -HRP.CFrame.RightVector * MaxWallrunRadius, params)
if left and left.Instance then
Wallrunning = -1
WallrunningNormal = Vector3.new(left.Normal.Z, 0, -left.Normal.X)
Signal:FireClient(plr, -CameraTiltAmount)
if not wallRunLeftAnimTrack.IsPlaying and not isLeftAnimationPlaying then
wallRunLeftAnimTrack:Play()
wallRunRightAnimTrack:Stop()
isLeftAnimationPlaying = true
end
end
end
elseif Wallrunning then
Wallrunning = false
Velocity.Enabled = false
Signal:FireClient(plr, 0)
Velocity.VectorVelocity = Vector3.new(0, 0, 0)
HRP.Velocity = Vector3.new(0, JumpPower, 0) -- Jump out of wall run
if isLeftAnimationPlaying then
wallRunLeftAnimTrack:Stop()
isLeftAnimationPlaying = false
end
if isRightAnimationPlaying then
wallRunRightAnimTrack:Stop()
isRightAnimationPlaying = false
end
end
end)
RS.Heartbeat:Connect(function(dt)
if hum:GetState() == Enum.HumanoidStateType.Freefall or hum:GetState() == Enum.HumanoidStateType.FallingDown then
if Wallrunning then
Velocity.Enabled = true
local result = workspace:Raycast(HRP.Position, HRP.CFrame.RightVector * MaxWallrunRadius * Wallrunning, params)
if result and result.Instance then
local v = WallrunningNormal * Speed * -Wallrunning * dt
Velocity.VectorVelocity = Vector3.new(v.X, -Gravity, v.Z)
else
Wallrunning = false
end
else
if Velocity.Enabled then
Velocity.Enabled = false
Signal:FireClient(plr, 0)
Velocity.VectorVelocity = Vector3.new(0, 0, 0)
end
end
else
Wallrunning = false
Velocity.Enabled = false
Signal:FireClient(plr, 0)
Velocity.VectorVelocity = Vector3.new(0, 0, 0)
if isLeftAnimationPlaying then
wallRunLeftAnimTrack:Stop()
isLeftAnimationPlaying = false
end
if isRightAnimationPlaying then
wallRunRightAnimTrack:Stop()
isRightAnimationPlaying = false
end
end
end)