Menu Camera Work's Perfectly on PC, but not on mobile

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)

Anyone know why its doing this?

1 Like

As far as i’m aware, your code looks fine. Maybe try playing the game on your phone from roblox client. Most likely it’s a studio anomaly.

Same thing occurs, the mobile client doesnt work also

On the line where you write:

local PlayerBTN = script.Parent.Play

Change this line to:

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)

Still doesn’t work sadly, prob the mobile client is broken or smth :confused:

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.

It works perfectly fine, but im talking about how it doesnt work on mobile


(I used the updated script)

Wow, I really don’t know what your problem is, but I don’t have one…

@Noahboy71 if you don’t mind, I can help you in TeamCreate. just add me there.

Looks like i fixed the issue, i had the transfer the script to another script that was linked to the play button

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.