No matter in which way i shape the code i havent been able to get the raycast to be perfectly oriented towards the lookvector.
The script outputs that the raycast is not hitting anything, which should not be possible considering the origin of the raycast is located within 6 walls, therefore the sky is not visible at all.
picture of where the raypart is located: (imgur.com/a/h7j1kZh)
Heres the code:
while true do local result = workspace:Raycast(script.Parent.startP.Position, script.Parent.startP.CFrame.LookVector) if result then local newpart = Instance.new("Part", workspace) newpart.Position = result.Position newpart.Shape = Enum.PartType.Ball newpart.Size = Vector3.new(0.1,0.1,0.1) newpart.BrickColor = BrickColor.Red() newpart.CanCollide = false newpart.CanQuery = false newpart.CanTouch = false newpart.Material = Enum.Material.Neon wait() newpart:Destroy() else wait() warn("No raycast result!") end end
Thanks to anyone that helps in advance
You've given the RayCast a direction, but haven't given the direction a length.
As an example, adding * 5 to the direction will make it RayCast 5 studs in that direction.
script.Parent.startP.CFrame.LookVector * 5