So, there are two scripts, the one inside of the button, and the one that controls the camera. The one that is inside of the button is this one:
script.Parent.Text = "Spectate"
script.Parent.AutoButtonColor = false
function onClick()
script.Parent.TextColor3 = Color3.new(1,1,1)
if script.Parent.Text == "Spectate" then
script.Parent.Text = "Stop Spectating"
script.Parent.CamScript.Disabled = false
else
script.Parent.Text = "Spectate"
script.Parent.CamScript.Disabled = true
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Custom
end
end
script.Parent.MouseButton1Down:connect(onClick)
function over()
script.Parent.TextColor3 = Color3.new(.5,.5,.5)
end
script.Parent.MouseEnter:connect(over)
function leave()
script.Parent.TextColor3 = Color3.new(1,1,1)
end
script.Parent.MouseLeave:connect(leave)
There is one thing wrong with this, when the text is "Spectate" it does the 2nd part of the script that's supposed to happen when the text says "Stop Spectating".
Here is the CamScript, it's directly from the wiki except the CameraSubj:
workspace.CurrentCamera.CameraType = Enum.CameraType.Scriptable
workspace.CurrentCamera.CameraSubject = workspace.CameraPart
local angle = 0
while wait() do
workspace.CurrentCamera.CoordinateFrame = CFrame.new(workspace.CameraPart.Position) --Start at the position of the part
* CFrame.Angles(0, angle, 0) --Rotate by the angle
* CFrame.new(0, 0, 5) --Move the camera backwards 5 units
angle = angle + math.rad(1)
end
When I go into the cameras properties, the CameraType is still custom, and the CameraSubj is Humanoid. Please help.
I'm also new to camera manipulation
