So, I have a script for a loading screen that changes the character camera until a button is clicked. The camera position is based off the location of a part in workspace. I have a script that makes the part move back and fourth, but the camera doesn’t seem to follow the part as it moves. I am looking for some help on how to fix this issue, I will provide the code below.
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.PlayButton
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame
PlayButton.MouseButton1Click:Connect(function()
Camera.CameraType = Enum.CameraType.Custom
end)
Usually I dont support this but its an easy fix so here you go.
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local PlayButton = script.Parent.PlayButton
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
local con = game:GetService("RunService").RenderStepped:Connect(function()
Camera.CFrame = workspace.CameraPart.CFrame
end
PlayButton.MouseButton1Click:Connect(function()
Camera.CameraType = Enum.CameraType.Custom
con:Disconnect()
con = nil
end)