I made spinner that if its touched, then it would teleport the player back to where they started (like an obby). But when I was testing it when friends, it would lag. Here's the script:
local teleportpart = script.Parent --the part
while true do --the loop
script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0.102,0)
teleportpart.Touched:Connect(function(hit) --function when player touches part
if hit.Parent:WaitForChild("HumanoidRootPart") then
game.Players[tostring(hit.Parent.Name)].Character:SetPrimaryPartCFrame(CFrame.new(228.5,24.5,880)) --where it teleports the player
end
end)
wait()
end
Any help would be appreciated!

1 comment
To answer your question before, the while loop runs at longer intervals (meaning less threads) and just interpolates the cframes with TweenService.