Just like the the title says, when I press play the camera goes back to the player:
but when I tested it on mobile, the camrea stays in the same position from the menu screen
Heres the script
--Varibles
local CurrentCamera = workspace.CurrentCamera
local Part = workspace:WaitForChild("MenuCamera")
local PlayerBTN = script.Parent.Play
local PlayerGetter = game:GetService("Players")
local Player = PlayerGetter.LocalPlayer
wait(0.001)
--Set the camera position to MenuCamera
CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = Part.CFrame
--Functions
function Play()
wait(2)
CurrentCamera.CameraType = Enum.CameraType.Custom
script:Destroy()
end
--Run the Function
PlayerBTN.MouseButton1Click:Connect(Play)
local PlayerBTN = script.Parent:WaitForChild("Play")
I see the fadeout effect is working correctly (I assume it’s accomplished using a different script), this may just be an issue with this script running first and not getting the object.
If this isn’t the issue, I would probably recommend changing this part:
--Functions
function Play()
wait(2)
CurrentCamera.CameraType = Enum.CameraType.Custom
script:Destroy()
end
--Run the Function
PlayerBTN.MouseButton1Click:Connect(Play)
to:
--Define and run the function
PlayerBTN.MouseButton1Click:Connect(function()
wait(2)
CurrentCamera.CameraType = Enum.CameraType.Custom
script:Destroy()
end)
I don’t know, everything works fine for me. here is the video.
Here’s the script itself (I changed the camera assignment mechanism a bit):
--Varibles
local CurrentCamera = workspace.CurrentCamera
local Part = workspace:WaitForChild("MenuCamera")
local PlayerBTN = script.Parent:WaitForChild("Play")
local PlayerGetter = game:GetService("Players")
local Player = PlayerGetter.LocalPlayer
--Functions
local function Init()
repeat CurrentCamera.CameraType = Enum.CameraType.Scriptable task.wait() until CurrentCamera.CameraType == Enum.CameraType.Scriptable
CurrentCamera.CFrame = Part.CFrame
end
function Play()
wait(2)
CurrentCamera.CameraType = Enum.CameraType.Custom
script:Destroy()
end
--Run the Function
Init()
PlayerBTN.MouseButton1Click:Connect(Play)
maybe the problem is that you have another script or scripts for a dynamic camera that moves from the cursor direction or from a beat of music, I’m not sure.
By the way, you can try to change the camera parameter, when clicking on the button to Enum.CameraType.Track.
If this doesn’t solve the problem (and it will 99% of the time), then show me other scripts that control the camera.