I recently learned how to make it so parts can focus on a certain part or thing and i wanna do that with the player. I want the player's torso to rotate at where the part is when it gets near it but it isnt working correctly..
local Part = script.Parent
while wait() do
local Players = game:GetService('Players'):GetPlayers()
for i,v in pairs(Players) do
if v ~= nil and v.Character ~= nil then
local Torso = v.Character:FindFirstChild('Torso')
if Torso and (Torso.Position - Part.Position).Magnitude <= 10 then
Torso.CFrame = CFrame.new(Torso.Position, Torso.Position)
end
end
end
end

2 comments
How about next time you also learn how to indent?
We code in different ways, I like this way because nicer and much easier to read. Not like other idiots (You) that got out the border.