Im making a ray cast so that my character can go up slower on slopes and down fast on slopes while rolling, I want it to be able to identify the part by printing it in the output.
But I got an error saying that Name is not a Property of RaycastResult, so how can I print and identify the part that collided with the raycast?
Script:
local HRP = script.Parent:WaitForChild("HumanoidRootPart")
local settingS = RaycastParams.new()
settingS.IgnoreWater = false
while task.wait() do
local ray = workspace:Raycast(HRP.Position, Vector3.new(0,-10,0), settingS)
if ray then
print(ray.Name)
end
end
RaycastResult.Instance is a reference to the instance (object) the ray intersected. Be wary though, as warned here ‘RaycastResult’ is nil in cases where the ray intersects nothing.