So I'm trying to make a Menu gui with a camera but when I tested it out, it says CameraPoint is not a valid member of Folder which is confusing because in my script the folder which the Part that is the camera is a member of, and the name of the folder is correct.
This is the entire script (open sourced) Error is at line 22
--// Services
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
--// Main Variables
local spawned = false
local teamOpen = false
--// Player
local Player = Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
local Gui = script.Parent
--// Character
local Character = Player.Character or Player.CharacterAdded:Wait()
local CharHMR = Character:WaitForChild("HumanoidRootPart")
--// World
local cameraPoint = game.Workspace.Cameras.CameraPoint
--// Functions
Gui.Enabled = true
Gui.Menu.Play_Button.MouseButton1Click:Connect(function()
spawned = true
end)
Gui.Music.Song:Play()
Gui.Menu.Store_Button.MouseButton1Click:Connect(function()
if teamOpen == false then
Gui.Menu.Store_Select:TweenPosition(UDim2.new(.5,0,0.5,0), "Out", "Linear", 0.2)
teamOpen = true
else
Gui.Menu.Store_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end
end)
Gui.Menu.Store_Button.MouseButton1Click:Connect(function()
if teamOpen == false then
Gui.Menu.Store_Select:TweenPosition(UDim2.new(.5,0,0.5,0), "Out", "Linear", 0.2)
teamOpen = true
else
Gui.Menu.Store_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end
end)
Gui.Menu.TeamSwitch_Button.MouseButton1Click:Connect(function()
if teamOpen == false then
Gui.Menu.Team_Select:TweenPosition(UDim2.new(.5,0,0.5,0), "Out", "Linear", 0.2)
teamOpen = true
else
Gui.Menu.Team_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end
end)
Gui.Menu.TeamSwitch_Button.MouseButton1Click:Connect(function()
if teamOpen == false then
Gui.Menu.Team_Select:TweenPosition(UDim2.new(.5,0,0.5,0), "Out", "Linear", 0.2)
teamOpen = true
else
Gui.Menu.Team_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end
end)
Gui.Menu.Store_Select.Back.MouseButton1Click:Connect(function()
Gui.Menu.Store_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end)
Gui.Menu.Team_Select.Back.MouseButton1Click:Connect(function()
Gui.Menu.Team_Select:TweenPosition(UDim2.new(.5,0,-1,0), "Out", "Linear", 0.2)
teamOpen = false
end)
RunService.RenderStepped:Connect(function()
if spawned == false then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = cameraPoint.CFrame
else
Gui.Enabled = false
Gui.Music.Song:Stop()
game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
game.Workspace.CurrentCamera.CameraType = "Custom"
end
end)

1 comment
Try: game.Workspace.Cameras:WaitForChild("CameraPoint")