when i Jump in front of a wall, the ray doesnt hit anything and The output says “nil”. Was this raycasting supposed to be done in server-side.?
origin = hrp.Position
direction = hrp.CFrame.LookVector * 10
origin = hrp.Position
direction = hrp.CFrame.LookVector * 10
function wallCheck()
local raycastResult = workspace:Raycast(origin, direction, raycastParams)
if raycastResult then
local hitpart = raycastResult.Instance
if hitpart then
return true
end
end
end
hum.StateChanged:Connect(function(oldState, newState)
if newState == Enum.HumanoidStateType.Jumping and can_long_jump == true then
hrp.Velocity = hrp.CFrame.LookVector * (longJumpSpeed+50) + Vector3.new(0, 50, 0)
loadedLongJumpAnim:Play()
elseif newState == Enum.HumanoidStateType.Landed then
loadedLongJumpAnim:Stop()
hum.WalkSpeed = 16
elseif newState == Enum.HumanoidStateType.Jumping and can_long_jump == false then
local walldetection = wallCheck()
print(walldetection)
if walldetection == true then
hrp.Velocity.Y = Vector3.new(0, 50, 0)
end
end
end)