function module.DistanceFromKill()
local nearestEnemy = nil
local nearestRoot = math.huge
workspace.SmilingKidWithRope.SmilingKid.Parent = workspace
local root = workspace.SmilingKid.HumanoidRootPart
for i, v in pairs(workspace.Game.People:GetChildren()) do
local plrRoot = v:FindFirstChild("HumanoidRootPart")
if plrRoot and plrRoot ~= root then
local mag = (plrRoot.Position - root.Position).Magnitude
if mag < 10 and mag < nearestRoot then
nearestEnemy = plrRoot
nearestRoot = mag
end
end
end
if nearestEnemy then
root.CFrame = nearestEnemy.CFrame * CFrame.new(0, 0, 3)
end
end
Please help. This is my second time posting this and it would be appreciated.

6 comments
Btw smiling kid is a rigged character. WIll this still Apply?
It still hasn't worked.
Is there an error? What happens?
There is no error. it just doesn't teleport at all and nothing appears in the output. I tried debugging using prints that I put right below "if nearestEnemy then" and it Printed but the script below it still didn't work.
Sorry I couldn't respond earlier. It was like 3 a clock for me then.
Never mind! I changed it to SetPrimaryPartCFrame and it worked find with the rest of your changed script! THANKS A TON!