So i'm making a spectate GUI, as the title states, but i'm having trouble changing the local current camera, how would i fix this?
1 | target = script.Parent.Parent.TextBox.target.Value |
2 |
3 |
4 | script.Parent.MouseButton 1 Click:Connect( function () |
5 | game.Workspace.Camera.CameraSubject = target |
6 | end ) |
Thanks,
I would recommend making the target value the player of the character you wish to spectate. If this is what you are doing then copy below and paste.
01 | local camera = workspace.CurrentCamera |
02 | local target = script.Parent.Parent.TextBox.target |
03 |
04 | script.Parent.MouseButton 1 Click:Connect( function () |
05 | local char = target.Value.Character or workspace:FindFirstChild(target.Value.Name) |
06 | if not char then return end |
07 | local humanoid = char:FindFirstChildOfClass( "Humanoid" ) |
08 | if not humanoid then return end |
09 | camera.CameraSubject = humanoid |
10 | end ) |