Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Stop Camera Manipulation Spinning Script not working?

So I have done the camera manipulation using wiki, but I tested it, Clicked Play and the screen was still spinning. The Camera Manipulation Script is here.

local target = workspace.IntroBrick
local Cam = Game.Workspace.CurrentCamera
Cam.CameraSubject = Game.Workspace.IntroBrick
Cam.CameraType = "Scriptable"
Cam.CameraSubject = target
local angle = 0

-- Up Above is the Camera locking to the part
while wait() do
   Cam.CoordinateFrame = CFrame.new(target.Position)
                           * CFrame.Angles(0, angle, 0)
                           * CFrame.new(0, 0, 5)
    angle = angle + math.rad(1)
end

And the stopping Script is this,

Cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
Cam.CameraType = "Custom"

I put the script above in a LocalScript inside a Play GUI. The "Cam" in this script is the CurrentCamera in workspace. Please edit the script.

1 answer

✓ Accepted answer

It'll never reach that section of the script because the while loop isn't stopping. Functions and variables like wait() will return true if they aren't nil which is what's happening. Now that we've found the problem the new question is how to solve it. We could use counters, an event or

--LocalScript
local ply = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
local circleScript = game.Workspace.SpinScript --Replace with path of circle script
local time = 5 --In seconds

wait(time)
circleScript.Disabled = true
cam.CameraSubject = ply.Character.Humanoid
cam.CameraType = "Custom"

or you could just replace wait() in the while loop with a Boolean variable and set a conditional in the while loop that sets the Boolean to false.

This discussion is preserved as it was. New answers, comments, and votes are closed.