Hi everyone. I’m trying to make an intro screen for my game and have come across a problem. The camera isn’t moving to a part. (This should be a simple fix and ngl I suck at scripting) Here is the script:
local cam = game.Workspace.CurrentCamera
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = game.Workspace.IntroCamPart.CFrame
local playbutton = script.Parent
local creditbutton = script.Parent.Parent.Credits
local donobutton = script.Parent.Parent.Donate
local title = script.Parent.Parent.Title
local back = script.Parent.Parent.Back
back.Visible = false
local introUI = script.Parent.Parent
introUI.Enabled = true
introUI.CreditsFrame.Visible = false
introUI.DonoFrame.Visible = false
script.Parent.Parent.Parent["Mute / unmute music"].Enabled = false
script.Parent.Parent.Parent.PassUI.Enabled = false
script.Parent.Parent.Parent.SprintGui.Enabled = false
playbutton.MouseButton1Click:Connect(function()
cam.CameraType = Enum.CameraType.Custom
introUI.Enabled = false
script.Parent.Parent.Parent["Mute / unmute music"].Enabled = true
script.Parent.Parent.Parent.PassUI.Enabled = true
script.Parent.Parent.Parent.SprintGui.Enabled = true
end)
@Hqsuperlabgames That’s strange. This is a localscript inside of a textbutton inside of a screengui in startergui but it shouldn’t change how it works.
As you can see, Heartbeat is the very last in this, after all rendering and simulation.
That means it will force the script to run after we’re certain the camera has actually loaded in, by waiting for a frame to be rendered.
I did this and it worked while in a textbutton in a screengui: