I am getting no errors back about this script when I attempt to wallrun, both jumping or walking off a ledge onto a wall. Is there any suggestions on how to fix this? The animations do not play, nor does the HRP connect to the wall
local char = game:GetService("Players").LocalPlayer.Character or game:GetService("Players").LocalPlayer.CharacterAdded:Wait()
local HRP = char:WaitForChild("HumanoidRootPart")
local Humanoid = char:WaitForChild("Humanoid")
local ava = true
local has = false
local hold = false
local left = false
local right = false
local leftplaying = false
local rightplaying = false
local LA = Humanoid:LoadAnimation(script:WaitForChild("WallRunAnim"))
local LA = Humanoid:LoadAnimation(script:WaitForChild("WallRunRightAnim"))
local Vel - Instance.new("BodyVelocity",HRP)
local BGO = Instance.new("BodyGyro",HRP)
BGO.D = 100
BGO.p = 1000
BGO.MaxTorque = Vector3.new(0,0,0)
BGO.Name = "Rot"
Vel.MaxForce = Vector3(0,0,0)
Vel.Name = "Vel"
function render()
local r = Ray.new(HRP.CFrame.p, HRP.CFrame.rightVector * -3)
local r2 = Ray.new(HRP.CFrame.p, HRP.CFrame.rightVector * 3)
local part, position, normal = workspace:FindPartOnRayWithIgnoreList(r,(char))
local part, position, normal = workspace:FindPartOnRayWithIgnoreList(r2,(char))
local cross = Vector3.new(0,1,0):Cross(normal)
local cross2 = Vector3.new(0,1,0):Cross(normal2)
if (part and ava) or (part2 and ava)then
--if normal.y == 0 or normal2.y = 0
if (part and part.Name == "Wallrun") or (part2 and part2.Name == "WallRun") then
if part then
HRP.CFrame = CFrame.new(HRP.CFrame.p,Vector3.new(HRP.Position.X + cross.x,HRP.PositionY,HRP.Position.Z + cross.z))
elseif part2 then
HRP.CFrame = CFrame.new(HRP.CFrame.p,Vector3.new(HRP.Position.X - cross.x,HRP.PositionY,HRP.Position.Z - cross.z))
end
has = true
hold = true
if hold then
BGO.CFrame = HRP.CFrame
BGO.MaxTorque = Vector3.new(1,1,1) * math.huge
Vel.MaxForce = Vector3.new(1,1,1) * math.huge
hold = false
if part then
Vel.Velocity = cross * 50
left = true
elseif part2 then
Vel.Velocity = -cross2 * 50
right = true
end
end
end
elseif (ava and not part and not part2 and has and not hold) then
BGO.MaxTorque = Vector3.new(0,0,0)
Vel.MaxForce = Vector3(0,0,0)
ava = false
left = false
right = false
LA:Stop() RA:Stop()
if has then
wait(0.5)
ava = true
has = false
end
end
if left and not leftplaying then
LA:Play() leftplaying = true
elseif left and not leftplaying then
LA:Stop() leftplaying = false
end
if right and not rightplaying then
RA:Play() rightplaying = true
elseif right and not rightplaying then
RA:Stop() rightplaying = false
end
end
game:GetService("RunService").RenderStepped:Connect(function()
render()
end)
