What do you want to achieve? Keep it simple and clear!
Force the player’s camera to be at a specific spot then when a UI button is triggered, return it to normal.
What is the issue? Include screenshots / videos if possible!
Nothing I try moves the camera.
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
Setting the CFrame to be the same as a part’s, setting the part as the camera’s subject.
local event = game.ReplicatedStorage.mainCameraEvent
--"fix" to fix the camera, "set" to set the menuCam
event.OnServerEvent:Connect(function(player, actionType)
if actionType == "fix" then
task.wait(0.5)
workspace.CurrentCamera.CameraSubject = player.Character.HumanoidRootPart
workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
--workspace.CurrentCamera.CameraMode = Enum.CameraMode.Classic
elseif actionType == "set" then
task.wait(0.5)
workspace.CurrentCamera.CameraSubject = workspace.menuCamPos
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
--workspace.CurrentCamera.CameraMode = Enum.CameraMode.LockFirstPerson
end
end)
local music = game.Workspace:WaitForChild("musicPlayer")
local menuMusic = game.Workspace.MainMenu.MenuMusic
music.Volume = 0
menuMusic:Play()
game.ReplicatedStorage.mainCameraEvent:FireServer("set")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
local TweenService = game:GetService("TweenService")
local CloseTweenInfo = TweenInfo.new(
1,
Enum.EasingStyle.Sine,
Enum.EasingDirection.InOut,
0,
false,
0
)
local CloseTween = TweenService:Create(player.PlayerGui.MainMenu.Frame, CloseTweenInfo, {Position = UDim2.new(0, 0,-1, 0)})
CloseTween:Play()
player.Character.HumanoidRootPart.Anchored = false
workspace.MainMenu.MenuMusic.Volume = 0
workspace.musicPlayer.Volume = 0.3
game.ReplicatedStorage.mainCameraEvent:FireServer("fix")
end)