I made a camera based menu for my game but I wanted to add a feature were pressing the play button would but the camera back to the players cam Ive already made it make the menu ui invisible and remove the blur on the camera I just need it to go back to the players view and I can figure it out
heres the code
local currentcam = workspace.CurrentCamera
local campart = workspace.CamPart
local playbutton = script.Parent.Play
wait(0.001)
currentcam.CameraType = Enum.CameraType.Scriptable
currentcam.CFrame = campart.CFrame
local function playEntered()
currentcam.CFrame = campart.CFrame
end
playbutton.MouseButton1Click:Connect(playEntered)
local camera = workspace.CurrentCamera
local camPart = workspace:WaitForChild("CamPart")
local playButton = script.Parent.Play
local connections = {}
table.insert(connections, camera:GetPropertyChangedSignal("CameraType"):Connect(function()
if camera.CameraType ~= Enum.CameraType.Scriptable then
camera.CameraType = Enum.CameraType.Scriptable
end
end))
table.insert(connections, camera:GetPropertyChangedSignal("CFrame"):Connect(function()
if camera.CFrame ~= camPart.CFrame then
camera.CFrame = camPart.CFrame
end
end))
playButton.MouseButton1Click:Connect(function()
local Character = game.Players.LocalPlayer.Character
if not Character then return end
local Humanoid = Character.Humanoid
if not Humanoid then return end
for i, v in pairs(connections) do v:Disconnect() end
camera.CameraType = Enum.CameraType.Custom
camera.CameraSubject = Humanoid
end)
i just changed some of the varibles for the workspace to game.workspace it works now though thank you so much for the help I spent all day trying to figure this out lol