✓ Accepted answer
First off, the cameras position can not be changed when the player first joins, so we need to check for when the humanoid sits, and when it does, we need to change the camera type to scriptable, allowing us to change the camera's position. The way we would do this is by connecting the changed event to the humanoid and seeing if its sitting.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char.Humanoid.Changed:Connect(function()
if char.Humanoid.Sit == true then
local CameraGui = game.ServerStorage.CameraGui:Clone()
CameraGui.Parent = plr.PlayerGui
CameraGui.Name = "CameraGui"
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
elseif char.Humanoid.Sit == false then
if plr.PlayerGui:FindFirstChild("CameraGui") then
plr.PlayerGui.CameraGui:Destroy()
workspace.CurrentCamera.CameraType=Enum.CameraType.Custom
end
end
end)
end)
end)
Ok, so now we have the GUI pop up when the player sits and dissapear when they stop sitting, but how do we actually change the camera's position, well first off, you will need a part somewhere in your plane called whatever you want, but in the next script, I will call it reference. Put a script in a text button inside the gui we cloned and put this in:
script.Parent.MouseButton1Click:Connect(function()
workspace.CurrentCamera.CFrame = workspace.modelNameHere.Reference.CFrame
end)
Thats all there is to it. Hope I helped.
-Cmgtotalyawesome