local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local Play = script.Parent.MenuFrame.Play
repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraPart.CFrame
Play.MouseButton1Click:Connect(function()
Camera.CameraType = Enum.CameraType.Scriptable
script.Parent.Parent:Destroy()
local Chapters = script.Parent.Parent.Chapters
local playerGui = player:WaitForChild("PlayerGui")
playerGui.Chapters.ChapterScreen.visible = true
end)
Are you trying to reset the camera back to the player after pressing the button? If so then in the event, you’re setting the CameraType to Scriptable whe nyou should be setting it to custom
Play.MouseButton1Click:Connect(function()
Camera.CameraType = Enum.CameraType.Custom
script.Parent.Parent:Destroy()
local Chapters = script.Parent.Parent.Chapters
local playerGui = player:WaitForChild("PlayerGui")
playerGui.Chapters.ChapterScreen.visible = true
end)
Looks like you wrote something wrong in your script. Did I find the error?
Look at the line local playerGui = player:WaitForChild("PlayerGui")
There seems there is no variable called “player”. Capitalize the letter “P”
You’re destroying the 2nd parent of the script, which also destroys the script and then afterwards trying to get the Chapters from it, which errors because script is nil now, put that line after
You’re trying to get the parent of something on the next line for something that doesn’t exist anymore, that’s your issue
Also, why are you declaring the playerGui variable if the script is in StarterGui which gets cloned to PlayerGui anyways, and it’s never used so it’s kinda uneeded