Hey, I’ve been working on a project and ran into an issue here with ray casts.
Script
repeat
local raycastParams = RaycastParams.new()
raycastParams.FilterDescendantsInstances = {script.Parent, script.Parent.End, script.Parent.start, script.Parent.Parent, script.Parent.Parent.Arm, script.Parent.Parent.Base, script.Parent.Parent.MeshPart}
raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
local ray = workspace:Raycast(script.Parent.Position, 100*(script.Parent.End.Position - script.Parent.start.Position).Unit, raycastParams)
if ray then
print(ray.Instance.Name, ray.Instance.Position)
script.Parent.End.Position = ray.Instance.Position
task.wait(1)
end
task.wait()
until false
Initial:
Final:
Output:
it keeps printing the last output even if the part is not in the way.
If you still haven’t go the issue, the End
attachment’s position is not the same as object’s position, it prints 9 or 11 but it moves to 500 in Y axis.
Any help would be appreciated