Hi y’all, I’ve been trying to make my own Wallrun system and everything works fine, but when I try to implement jumping when ending the wallrun, it doesn’t go as smooth as possible… It so unconsinstent and on mobile it won’t even work, I thought that maybe it could due to the timing of the jump but it doesn’t work anyway.
Code:
-LocalScript- (Not the full code, just what it needs to be understandable)
local function DisableParticles() --Just disables particles
for _, particle in rootPart.WalkingParticles:GetChildren() do
particle.Enabled = false
end
end
local function ExitWallrun() --This is the function called when exiting the wallrun
event:FireServer(false)
hum.AutoRotate = true
WallrunLeftTrack:Stop()
WallrunRightTrack:Stop()
DoubleJumpTrack:Play()
DisableParticles() --
LastCooldown = tick() --This is just used to check a cooldown
end
--Here's the code that activates when you jump off the wall
ExitWallrun()
hum.JumpPower = JUMP_POWER * JUMP_MULTIPLIER
hum:ChangeState(Enum.HumanoidStateType.Jumping)
rootPart:ApplyImpulse(WallrunningDirection == 1 and -rootPart.CFrame.RightVector * JUMP_IMPULSE or rootPart.CFrame.RightVector * JUMP_IMPULSE)
-Server-
local function Wallrun(plr: Player, active: boolean, Velocity: Vector3)
local char = plr.Character
local rootPart = char.HumanoidRootPart
local LinearVelocity = rootPart.WallrunVelocity
if active and plr:GetAttribute("Wallrunning") == false then
plr:SetAttribute("Wallrunning", true)
LinearVelocity.VectorVelocity = Velocity
LinearVelocity.Enabled = true
elseif not active and plr:GetAttribute("Wallrunning") == true then
plr:SetAttribute("Wallrunning", false)
LinearVelocity.Enabled = false
LinearVelocity.VectorVelocity = Vector3.zero
end
end
event.OnServerEvent:Connect(Wallrun)
Basically when you jump off the wall, it sends an event to the server telling it to set the LinearVelocity to 0,0,0 and then it tries to jump off the wall but it rarely does. Thanks in advance!