Sorry if the title is confusing haha.
I have 2 scripts that changes the camera of the player to a custom camera, but, while yes it works I have no idea how to put the camera back to the player. I’ve tried just reversing the process but that didn’t work and I don’t know any other way to overcome this problem.
ServerScriptService:
local Seat = game.Workspace.Chair.Seat
local RemoteEvent = game.ReplicatedStorage.RemoteEvents.CamSeat
local RemoteEvent2 = game.ReplicatedStorage.RemoteEvents.PlayerCam
Seat.Changed:Connect(function()
if Seat.Occupant ~= nil then
local Player = game.Players:GetPlayerFromCharacter(Seat.Occupant.Parent)
RemoteEvent:FireClient(Player)
end
end)
Seat.Changed:Connect(function()
if Seat.Occupant == nil then
local Player = game.Players:GetPlayers()
RemoteEvent2:FireClient(Player)
end
end)
StarterPlayerScripts:
local Seat = script.Parent
local RemoteEvent = game.ReplicatedStorage.RemoteEvents.CamSeat
local RemoteEvent2 = game.ReplicatedStorage.RemoteEvents.PlayerCam
local Camera = game.Workspace.CurrentCamera
local Camera1 = game.Workspace.CameraSeat
local Player = game.Players.LocalPlayer
RemoteEvent.OnClientEvent:Connect(function()
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = Camera1.CFrame
end)
RemoteEvent2.OnClientEvent:Connect(function()
Camera.CameraType = Enum.CameraType.Track
Camera.CFrame = Player.Character.Head.CFrame
end)
I’ve also tried finding other DevForum topics for this but none of them helped.
Sorry if it’s a simple solution, I just started actually investing my time to learn lua, but any help is appreciated!