Why wouldn't the Camera's Subject be focused on the truss? Here is the Code:
01 | local cam = workspace.CurrentCamera |
02 | local button = game.Players.LocalPlayer:WaitForChild( "PlayerGui" ):WaitForChild( "ScreenGui" ) |
03 | -- In Line 2 SH cut off :WaitForChild("ScreenGui") |
04 | game.Players.PlayerAdded:connect( function (plr) |
05 | cam.CameraSubject = workspace:FindFirstChild( "Truss" ) |
06 | end ) |
07 |
08 | button.TextButton.MouseButton 1 Down:connect( function () |
09 | cam.CameraSubject = plr.Character:WaitForChild( "Humanoid" ) |
10 | end ) |
This Error kept popping up in the Output
Please Respect that I am a Beginner.
Make a LocalScript in the Backpack
1 | local player = game.Players.LocalPlayer |
2 | cam = game.Workspace.CurrentCamera |
3 |
4 | player:WaitForChild( "PlayerGui" ):WaitForChild( "ScreenGui" ):WaitForChild( "TextButton" ).MouseButton 1 Down:connect( function () |
5 | cam.CameraSubject = player.Character.Humanoid |
6 |
7 | end ) |
8 | cam.CameraSubject = game.Workspace:FindFirstChild( "Truss" ) |
When you use the MouseButton1Down event on a TextButton, the 2 arguments in the function are where on the button it was clicked, not the player. Try doing this:
1 | button.TextButton.MouseButton 1 Down:connect( function (X, Y) |
2 | cam.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild( "Humanoid" ) |
3 | end ) |