Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

teleporting to a part loop not working as expected?

Asked by 2 years ago
Edited 2 years ago

so i have this code for a toggle switch in a ui

    if state then
        local Object = game:GetService("Workspace")[".Spawns"][".Orbs"].Orb
        while wait() do
            game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = Object.CFrame
        end
    else

    end
end)

the if state then code runs if the toggle switch is set to true, i made it so that orbs spawn randomly in my game and there is a toggle switch that is meant to collect them all for you and it works except toggling it off does nothing and it tps only once then spam tps you to the spot where the original orb was, it doesnt tp to the ones that spawn after.. if anyone would help me with this id be really thankful, also sorry for any mistakes im new to the site

Answer this question