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

How do I cause the camera to return to normal on mouseclick?

I'm using a script which fixes the camera at a certain location, and all works well with that. What I don't know, though, is how to return the camera to normal when the start button is pressed. How would this be achieved? Thanks in advance.

The script:

local cam = workspace.CurrentCamera
local CameraLocation = Vector3.new(-22.5, 35.5, -58.5)
local CameraDirection = Vector3.new(-8, 4.5, -92)

cam.CameraType = Enum.CameraType.Scriptable

game["Run Service"].RenderStepped:connect(function()
	cam.CoordinateFrame = CFrame.new(CameraLocation,CameraDirection)
end)


--[[ Title Screen Script ]]


function onClicked()
    titlescreen:Destroy()
	cam.CameraType = Enum.CameraType.Fixed
end

titlebutton.MouseButton1Down:connect(onClicked)

1 answer

You have:

    cam.CameraType = Enum.CameraType.Fixed 

when it should be:

cam.CameraType = "Fixed"

5 comments

0

Thanks!

0

np

0

Er, I changed it and the camera still stays fixed at that position?

0

I see you have "titlescreen" but you dont have a variable in the script you posted. I would mabey need t see the whole script to understand. Sorry, I am a bit new to scripting but could mabey help you out.

0

Titlescreen is all in the title screen script, my only problem right now is the camera. It changes to a fixed position but then refuses to follow the character again, even if the camera type is set to Fixed. I'm new as well, thanks for helping out.

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