Hello,
I want a start menu for my game.
I want to do this by changing the CFrame of the camera to that of the part. It works in Studio but not in the actual Roblox app.
Here’s my code(local script)
local players = game.Players.LocalPlayer
local camera = game.workspace:WaitForChild("Camera")
local part = game.Workspace:WaitForChild("FocusPart")
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
until camera.CameraType == Enum.CameraType.Scriptable and camera.CFrame == part.CFrame
Heres how its supposed to be(this happens in studio)
local part = game.Workspace:WaitForChild("FocusPart")
local Camera = workspace.CurrentCamera
local inMenu = true
local player = game.Players.LocalPlayer
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part.CFrame
Camera:GetPropertyChangedSignal("CameraType"):Connect(function()
if inMenu then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = part.CFrame
end
end)
player.PlayerGui:WaitForChild("ScreenGui").TextButton.MouseButton1Click:Connect(function()
if Camera.CameraType == Enum.CameraType.Scriptable then
inMenu = false
Camera.CameraType = Enum.CameraType.Custom
wait(0.01)
player.PlayerGui.ScreenGui.Enabled = false
end
end)