Hi! I wanted to implement a Wallrun feature into my game but the script does not work for some reason. Here is the local script
local hrp = char:WaitForChild("HumanoidRootPart")
local hum = 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 RA = hum:LoadAnimation(char:WaitForChild("RunAnimRIGHT"))
local LA = hum:LoadAnimation(char:WaitForChild("RunAnim"))
local Vel = Instance.new("BodyVelocity",hrp)
local BGO = Instance.new("BodyGyro",hrp)
BGO.D = 100
BGO.P = 10000
BGO.MaxTorque = Vector3.new(0,0,0)
BGO.Name = "Rot"
Vel.MaxForce = Vector3.new(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 part2, position2, normal2 = 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 (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.Position.Y, hrp.Position.Z + cross.z))
elseif part2 then
hrp.CFrame = CFrame.new(hrp.CFrame.p.Vector3.new(hrp.Position.X - cross2.x,hrp.Position.Y,hrp.Position.Z - cross2.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.new(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 not left then
LA:Stop()
leftPlaying = false
end
if right and not rightPlaying then
RA:Play()
rightPlaying = true
elseif not right then
RA:Stop()
rightPlaying = false
end
end
game:GetService("RunService").RenderStepped:Connect(render)```
The error is
> Vector3 is not a valid member of Vector3 - Client - WallRun:34