Prints nil and I'm surrounded by parts.
local char = workspace:WaitForChild("papasherms") local newRay = Ray.new( char:GetPrimaryPartCFrame().p, (char:GetPrimaryPartCFrame().p - (char:GetPrimaryPartCFrame() * CFrame.new(char.PrimaryPart.Size.X/2,0,0)).p).unit * 500 ) spawn(function() while (wait(1)) do local hit, pos, normal = workspace:FindPartOnRay(newRay, char) print(hit) end end)
I think you should use a LocalScript, put a LocalScript inside StarterPlayer > StarterCharacterScripts
, and paste this:
local Player = game:GetService("Players").LocalPlayer local Character = Player.Character spawn(function() while wait(1) do --tuple FindPartOnRay( Ray ray, Instance ignoreDescendantsInstance, bool terrainCellsAreCubes, bool ignoreWater ) local Hit, Pos, Normal = workspace:FindPartOnRay( Ray.new( Character.HumanoidRootPart.Position, Character.HumanoidRootPart.CFrame.lookVector * 500 ), Character ) print(Hit, Pos, Normal) end end)
Now, please read the script carefully and try to understand what's going on, this might help you in the future. Hope this helped!