I would like to have a start screen that changes to a cutscene when you press play, but even though the camera does go the the start menu position, it refuses to move after that.
I have tried setting camera type to scriptable, and searching for other people having problems like this, but I haven’t found anything. I am really new to camera positions (I just followed the side-scroller tutorial and edited it), so it may just be something really obvious that I didn’t see.
Script:
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
local BEvent = game.ReplicatedStorage.PressPlayBindableEvent
local CamNum = 1
local function IntroCam()
camera.CameraType = Enum.CameraType.Scriptable
local rootPosition = Vector3.new(-57.929, 0.537, 59.982)
local cameraPosition = Vector3.new(-48.44, 11.796, 73.57)
camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
end
local function Scene1()
camera.CameraType = Enum.CameraType.Scriptable
local rootPosition = Vector3.new(-53.32, 26.54, 110.48)
local cameraPosition = Vector3.new(-53.17, 33.5, 110.48)
camera.CFrame = CFrame.lookAt(cameraPosition, rootPosition)
end
local CamNames = {IntroCam, Scene1}
BEvent.Event:Connect(function(num)
CamNum = CamNum + 1
end)
RunService:BindToRenderStep(CamNames[CamNum], Enum.RenderPriority.Camera.Value + 1, CamNames[CamNum])
I am using a list to store the names of the functions so I can easily trigger different cutscenes.
alternatively, instead of changing the camera position, you could change the camera subject.
this is usually what i do although i think it is slightly less processing power to change the pos.
I don’t have any experience with setting CameraSubject, but I will try it.
Btw, I just found out the if I change a value in the first function, (IntroCam), then the camera position will change, the problem is just that it wont switch to the second function for some reason.
Is that script on the server side? You should move the player camera from a local script
Besides that, im not sure, but i think you cant use the RunService:BindToRenderStep() that way…
Try:
BEvent.Event:Connect(function(num)
RunService:BindToRenderStep(CamNames[CamNum], Enum.RenderPriority.Camera.Value + 1, CamNames[CamNum])
--we can remove the if i think but i will leave it there
if CamNum > 1 then
RunService:UnbindFromRenderStep(CanNames[CamNum])
end
CamNum = CamNum + 1
end)
--we still need this
RunService:BindToRenderStep(CamNames[CamNum], Enum.RenderPriority.Camera.Value + 1, CamNames[CamNum])