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

Camera Manipulation not resetting?

I'm making an intro GUI where the camera rotates around the baseplate, and for the most part it works, although it won't stop rotating.

Notes;

--Using Filtering Enabled
--Local Script
--The for loop works though..

Game place

local target = workspace.Baseplate
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

local stillPlay = true
local about = false

function play()
	stillPlay = false
end

function about()
	about = not about
	if about then
		script.Parent.AboutFrame:TweenPosition(UDim2.new(10, 0,0, 0))
	else
		script.Parent.AboutFrame:TweenPosition(UDim2.new(1, 0,0, 0))
	end
end

function doStuff()
	repeat 
		wait()
		camera.CoordinateFrame = CFrame.new(target.Position) 
								* CFrame.Angles(0, angle, 0)
								* CFrame.new(0, 200, 500)
		angle = angle + math.rad(1)
	until not stillPlay
	wait(.5)
	camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
	camera.CameraType = "Custom"
	for i = 0.1,2,0.05 do
		script.Parent.BackgroundTransparency = i
		script.Parent.Play.BackgroundTransparency = i
		script.Parent.Play.TextTransparency = i
		script.Parent.About.BackgroundTransparency = i
		script.Parent.About.TextTransparency = i
		script.Parent.AboutFrame.BackgroundTransparency = i
		wait()		
	end
end

if game:GetService("UserInputService").KeyboardEnabled then
	script.Parent:WaitForChild("Play").MouseButton1Click:connect(play)
	script.Parent:WaitForChild("About").MouseButton1Click:connect(about)
else
	script.Parent:WaitForChild("Play").TouchTap:connect(play)
	script.Parent:WaitForChild("About").TouchTap:connect(about)
end

doStuff()

1 answer

I could not replicate the error in your game place. Are you sure that you didn't accidentally delete a character or something?

This is a modified version of the script that you used so that I can simulate your GUI (I only used a Local Script and TextButton parented to a ScreenGUI) and everything worked:

local target = game.workspace.Baseplate
local camera = game.workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CameraSubject = target
local angle = 0

local stillPlay = true
local about = false

function play()
    stillPlay = false
end

function about()
   
end

function doStuff()
    repeat 
        wait()
        camera.CoordinateFrame = CFrame.new(target.Position) 
                                * CFrame.Angles(0, angle, 0)
                                * CFrame.new(0, 200, 500)
        angle = angle + math.rad(1)
    until not stillPlay
    wait(.5)
    camera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
    camera.CameraType = "Custom"
    for i = 0.1,2,0.05 do

        script.Parent.Play.BackgroundTransparency = i
        script.Parent.Play.TextTransparency = i

        wait()      
    end
end

if game:GetService("UserInputService").KeyboardEnabled then
    script.Parent:WaitForChild("Play").MouseButton1Click:connect(play)
else
    script.Parent:WaitForChild("Play").TouchTap:connect(play)
end

doStuff()

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