Lastnz
(Lastnz)
June 9, 2020, 5:46pm
#1
I am trying to get my camera to be fixed in one position for the entire play time.
It works in studio, But not on the actual game.
I have tried to loop it, But it does nothing.
This is the code (In a localscript in StarterPlayerScripts)
wait(0.1)
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
game.Workspace.CurrentCamera.CFrame = CFrame.new(14.4592133, 14.3372288, 22.1348114, -0.68974036, -0.291065753, 0.662977457, -1.49011594e-08, 0.915642917, 0.401992947, -0.7240569, 0.277270764, -0.631555796)
game.Workspace.CurrentCamera.FieldOfView = 63
Images:
In Studio:
In Game:
have you tried putting the script in other places. for example in StarterGUi if you did try putting it into a renderstepped.
EDIT:
when you are in your game check your Developer console and see if there is a error message.
I’d suggest you place it on startergui,according to my experience with player scripts I found out scripts there only run once.
Lastnz
(Lastnz)
June 9, 2020, 7:06pm
#4
Thank you. (30 charssssssssss)
Styre_x
(Styrex)
June 9, 2020, 7:07pm
#5
Your cameratype is likely being changed after the script runs. Add a connection to the heartbeat that you disconnect after the player clicks play.
local RunService = game:GetService("RunService")
local Connection
Connection = RunService.Heartbeat:Connect(function()
if workspace.CurrentCamera.CameraType ~= "Scriptable" then
workspace.CurrentCamera.CameraType = "Scriptable"
workspace.CurrentCamera.CFrame = CFrame.new(14.4592133, 14.3372288, 22.1348114, -0.68974036, -0.291065753, 0.662977457, -1.49011594e-08, 0.915642917, 0.401992947, -0.7240569, 0.277270764, -0.631555796)
workspace.CurrentCamera.FieldOfView = 63
end
end)
--other stuff
--play button clicked
Connection:Disconnect()
Hopefully that helps!