When play button is pressed the camera goes black

I have a menu gui where it makes all others gui’s disabled and after the play button is clicked, it enables them. But the screen goes black. Please help

Script:

local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Camera = workspace.CurrentCamera
local Mouse = Player:GetMouse()
local DefaultCFrame = workspace.MenuScene.CameraP
local Scale = 500
local Background = script.Parent
local PlayButton = Background.PlayB
local CreditsButton = Background.CreditsB
local StoreButton = Background.StoreB
local TweenService = game:GetService("TweenService")
local UI = Background.Parent
local PlayerUI = UI.Parent

for i, child in pairs(PlayerUI:GetChildren()) do
	if child:IsA("ScreenGui") then
	if child.Name ~= UI.Name then
			child.Enabled = false
	elseif child.Name == UI.Name then
		child.Enabled = true
		end
	end
end

Character:WaitForChild("HumanoidRootPart").Anchored = true

repeat wait()
	Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

game:GetService("RunService").RenderStepped:Connect(function()
	Camera.Focus = DefaultCFrame.CFrame
	local Center = Vector2.new(Camera.ViewportSize.Y/2, Camera.ViewportSize.X/2)
	local MoveVector = Vector3.new((Mouse.Y-Center.Y)/Scale, -(Mouse.X-Center.X)/Scale, 0)
	Camera.CFrame = DefaultCFrame.CFrame * CFrame.Angles(math.rad(MoveVector.X), math.rad(MoveVector.Y), math.rad(MoveVector.Z))
	Camera.FieldOfView = 90
end)

Camera.CFrame = DefaultCFrame.CFrame

PlayButton.MouseButton1Click:Connect(function()
	Character:WaitForChild("HumanoidRootPart").Anchored = false
	Camera.FieldOfView = 70
	
	for i, child in pairs(PlayerUI:GetChildren()) do
		if child:IsA("ScreenGui") then
			if child.Name ~= UI.Name and UI.Enabled == false then
				child.Enabled =true
			elseif child.Name == UI.Name then
				child.Enabled = false
				UI:Destroy()
			end
		end
	end
end)
1 Like

I fixed the problem, it was an admin system I have that interfered with the menu system

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.