Im really new to scripting in roblox studio and I need alot of help. Im using a code to set the camera to a part for a main menu backround. Im trying to make the script so when i press a GUI button it resets the camera angle back to the player. Here is my code so far:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame
(For the Camera going to the part, in my local script for my entire main menu)
script.Parent.MouseButton1Click:Connect(function()
workspace.CurrentCamera.CameraSubject = player.Character.Humanoid
end)
(For the GUI Button Press, its in the local script inside of the textbutton)
I get this error when i press the GUI button:
15:24:41.104 - Players.TheWinterSoilder551.PlayerGui.Main Menu.Sidebar.Play.Play Script:3: attempt to index nil with 'Character'
I really dont know how to fix it.

4 comments
Mind putting the code in code blocks?
Again im new, how do i do that?
Try editing then clicking the lua button during editing.
There you go