I'm trying to have this script print the name of wherever parts my character's torso is facing, but it just keeps on returning Nil... Why?
while true do
wait()
local Torso = game.Players.LocalPlayer.Character.Torso
local Humanoid = game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).Humanoid
--game.Workspace:WaitForChild(game.Players.LocalPlayer.Name).HumanoidRootPart.Velocity = Vector3.new(Torso.Velocity.X, Humanoid.JumpPower * 1.2, Torso.Velocity.Z)--hit.Position * CFrame.new(0,100,0)
local start = Vector3.new(Torso.CFrame)
local lookAt = Vector3.new(Torso.CFrame.lookVector)--(Torso.CFrame * CFrame.new(0,-1,0))
local ray = Ray.new(start, 999*(lookAt - start).unit)
local part, endPoint = workspace:FindPartOnRay(ray, game.Players.LocalPlayer.Character)
if part~=nil then
print(part.Name)
else
print("nil")
end
end

1 comment
okay, I hadn't noticed how much was wrong with this... You should review how to use Vectors correctly.