I have a script that change player camera Position to CamPart for my main menu screen, But… When try to make the camera position back to the player, it wont go back. here is the script
– Local
local GUI = script.Parent
local MainFrame = GUI.MainFrame
local Play = MainFrame.Play
– Set up
local Cam = workspace:WaitForChild(“Camera”)
local CamPart = workspace:WaitForChild(“CamPart”)
local Players = game:GetService(“Players”)
local LocalPlayers = Players.LocalPlayer
local Char = LocalPlayers.Character or LocalPlayers.CharacterAdded:Wait()
local Lighting = game:GetService(“Lighting”)
local Blur = Lighting:WaitForChild(“Blur”)
GUI.Enabled = true
– Function
local function PLAY()
Cam.CameraType = Enum.CameraType.Custom
Cam.CFrame = Char:WaitForChild(“Humanoid”)
end
– Script
Play.Activated:Connect(PLAY)
and the 2nd script that set the player camera when they join:
– Local
local Players = game:GetService(“Players”)
local mouse = Players.LocalPlayer:GetMouse()
local CamPart = workspace:WaitForChild(“CamPart”)
local Cam = workspace:WaitForChild(“Camera”)
– Set Cam
repeat
wait()
Cam.CameraType = Enum.CameraType.Scriptable
until
Cam.CameraType == Enum.CameraType.Scriptable
-- Move
local maxTilt = 15
game:GetService(“RunService”).RenderStepped:Connect(function()
Cam.CFrame = CamPart.CFrame * CFrame.Angles(
math.rad((((mouse.Y - mouse.ViewSizeY / 2) / mouse.ViewSizeY)) * -maxTilt),
math.rad((((mouse.X - mouse.ViewSizeX / 2) / mouse.ViewSizeX)) * -maxTilt),
0
)
end)
anyway Thanks