Random Rig Teleporter Wont Work

Im trying to randomly teleport rigs to a random part. Not sure why it wont work

local waypoints = workspace.PathfindingTest:GetChildren()
print(#waypoints)
local rigs = workspace.Guards:GetChildren()
wait(5)
while wait(1) do
for _,rig in ipairs(rigs) do
	local randomWM = math.random(1, #waypoints)
	print(randomWM)
	local randomW = waypoints[randomWM]
	print(randomW.Position)
	rig.HumanoidRootPart.Position = randomW.Position
end
end

update:it works on client but on server it just moves the rigs up by a few studs each loop

Use CFrame here instead. I believe that without it only the HumanoidRootPart moves without the rest of the limbs.

rig.HumanoidRootPart.CFrame = randomW.CFrame

or this

rig.HumanoidRootPart.CFrame = CFrame.new(randomW.Position)

since im unsure whether the waypoints are parts

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.