------------------------------------ Settings



local Player = game.Players.LocalPlayer
local tweenService = game:GetService("TweenService")
local Char = Player.Character
local Camera = game.Workspace.CurrentCamera
local MenuCam = game.Workspace:WaitForChild("MenuCam")
local Process = false

wait(game:IsLoaded())
MenuCam.Transparency = 1
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = MenuCam.CFrame
local BlurEffect = Instance.new("BlurEffect")
BlurEffect.Size = 0
BlurEffect.Parent = game.Lighting

local Black = tweenService:Create(script.Parent:WaitForChild("Black") ,TweenInfo.new(2, 
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out),
	{Transparency = 0})
local UnBlack = tweenService:Create(script.Parent:WaitForChild("Black"), TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {Transparency = 1})

local Blur = tweenService:Create(BlurEffect ,TweenInfo.new(2, 
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out),
	{Size = 20})
local UnBlur = tweenService:Create(BlurEffect ,TweenInfo.new(1, 
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.Out),
	{Size = 0})

if SettingsEnabled == false then
	script.Parent.SettingsButton.Visible = false
end
if CreditsEnabled == false then
	script.Parent.CreditsButton.Visible = false
else
	if script.Parent:WaitForChild("CreditsFrame"):WaitForChild("Frame"):FindFirstChild("TextLabel") then
		if script.Parent:WaitForChild("CreditsFrame"):WaitForChild("Frame"):WaitForChild("TextLabel").Text == "Scripter -" then
			script.Parent.CreditsFrame.Frame.TextLabel.Text = "Scripter - "..Player.Name
		end
	end
end
script.Parent:WaitForChild("GameMusic").Playing = true

script.Parent.SettingsButton.MouseButton1Click:Connect(function()
	if Process == true then return end
	Process = true
	if script.Parent.SettingsFrame.Position == UDim2.new(0.5, 0,-0.4, 0) then
		script.Parent.SettingsFrame:TweenPosition(UDim2.new(0.5, 0,0.5, 0), "Out", "Quad", 1)
		script.Parent.PlayButton:TweenPosition(UDim2.new(-0.3, 0,0.353, 0), "Out", "Quad", 0.5)
		script.Parent.SettingsButton:TweenPosition(UDim2.new(-0.3, 0,0.508, 0), "Out", "Quad", 0.5)
		script.Parent.CreditsButton:TweenPosition(UDim2.new(-0.3, 0,0.636, 0), "Out", "Quad", 0.5)
		Blur:Play()
	else
		script.Parent.SettingsFrame:TweenPosition(UDim2.new(0.5, 0,-0.4, 0), "Out", "Quad", 1)
		script.Parent.PlayButton:TweenPosition(UDim2.new(0.005, 0,0.353, 0), "Out", "Quad", 0.5)
		script.Parent.SettingsButton:TweenPosition(UDim2.new(0.005, 0,0.508, 0), "Out", "Quad", 0.5)
		script.Parent.CreditsButton:TweenPosition(UDim2.new(0.005, 0,0.636, 0), "Out", "Quad", 0.5)
		UnBlur:Play()
	end
	wait(2)
	Process = false
end)

script.Parent.CreditsButton.MouseButton1Click:Connect(function()
	if Process == true then return end
	Process = true
	if script.Parent.CreditsFrame.Position == UDim2.new(0.5, 0,-0.4, 0) then
		script.Parent.CreditsFrame:TweenPosition(UDim2.new(0.5, 0,0.5, 0), "Out", "Quad", 1)
		script.Parent.PlayButton:TweenPosition(UDim2.new(-0.3, 0,0.353, 0), "Out", "Quad", 0.5)
		script.Parent.SettingsButton:TweenPosition(UDim2.new(-0.3, 0,0.508, 0), "Out", "Quad", 0.5)
		script.Parent.CreditsButton:TweenPosition(UDim2.new(-0.3, 0,0.636, 0), "Out", "Quad", 0.5)
		Blur:Play()
	else
		script.Parent.CreditsFrame:TweenPosition(UDim2.new(0.5, 0,-0.4, 0), "Out", "Quad", 1)
		script.Parent.PlayButton:TweenPosition(UDim2.new(0.005, 0,0.353, 0), "Out", "Quad", 0.5)
		script.Parent.SettingsButton:TweenPosition(UDim2.new(0.005, 0,0.508, 0), "Out", "Quad", 0.5)
		script.Parent.CreditsButton:TweenPosition(UDim2.new(0.005, 0,0.636, 0), "Out", "Quad", 0.5)
		UnBlur:Play()
	end
	wait(2)
	Process = false
end)

script.Parent.CreditsFrame.ExitButton.MouseButton1Click:Connect(function()
	if Process == true then return end
	Process = true
	script.Parent.CreditsFrame:TweenPosition(UDim2.new(0.5, 0,-0.4, 0), "Out", "Quad", 1)
	script.Parent.PlayButton:TweenPosition(UDim2.new(0.005, 0,0.353, 0), "Out", "Quad", 0.5)
	script.Parent.SettingsButton:TweenPosition(UDim2.new(0.005, 0,0.508, 0), "Out", "Quad", 0.5)
	script.Parent.CreditsButton:TweenPosition(UDim2.new(0.005, 0,0.636, 0), "Out", "Quad", 0.5)
	UnBlur:Play()
	wait(2)
	Process = false
end)

script.Parent.SettingsFrame.ExitButton.MouseButton1Click:Connect(function()
	if Process == true then return end
	Process = true
	script.Parent.SettingsFrame:TweenPosition(UDim2.new(0.5, 0,-0.4, 0), "Out", "Quad", 1)
	script.Parent.PlayButton:TweenPosition(UDim2.new(0.005, 0,0.353, 0), "Out", "Quad", 0.5)
	script.Parent.SettingsButton:TweenPosition(UDim2.new(0.005, 0,0.508, 0), "Out", "Quad", 0.5)
	script.Parent.CreditsButton:TweenPosition(UDim2.new(0.005, 0,0.636, 0), "Out", "Quad", 0.5)
	UnBlur:Play()
	wait(2)
	Process = false
end)

if script.Parent.SettingsFrame.Frame:FindFirstChild("Shadows") then
	script.Parent.SettingsFrame.Frame.Shadows.MouseButton1Click:Connect(function()
		if script.Parent.SettingsFrame.Frame.Shadows.Text == "X" then
			script.Parent.SettingsFrame.Frame.Shadows.Text = ""
			game.Lighting.GlobalShadows = false
		else
			script.Parent.SettingsFrame.Frame.Shadows.Text = "X"
			game.Lighting.GlobalShadows = true
		end
	end)
end
if script.Parent.SettingsFrame.Frame:FindFirstChild("Time") then
	script.Parent.SettingsFrame.Frame.Time.MouseButton1Click:Connect(function()
		if script.Parent.SettingsFrame.Frame.Time.Text == "DAY" then
			script.Parent.SettingsFrame.Frame.Time.Text = "NIGHT"
			game.Lighting.ClockTime = NightClockTime
		else
			script.Parent.SettingsFrame.Frame.Time.Text = "DAY"
			game.Lighting.ClockTime = DayClockTime
		end
	end)
end
if script.Parent.SettingsFrame.Frame:FindFirstChild("Music") then
	script.Parent.SettingsFrame.Frame.Music.MouseButton1Click:Connect(function()
		if script.Parent.SettingsFrame.Frame.Music.Text == "X" then
			script.Parent.SettingsFrame.Frame.Music.Text = ""
			script.Parent.GameMusic.Playing = false
		else
			script.Parent.SettingsFrame.Frame.Music.Text = "X"
			script.Parent.GameMusic.Playing = true
		end
	end)
end
script.Parent.PlayButton.MouseButton1Click:Connect(function()
	if Process == true then return end
	Process = true
	script.Parent.Black.Transparency = 1
	wait(0.1)
	script.Parent.Black.Transparency = 0.9
	wait(0.1)
	script.Parent.Black.Transparency = 0.8
	wait(0.1)
	script.Parent.Black.Transparency = 0.7
	wait(0.1)
	script.Parent.Black.Transparency = 0.6
	wait(0.1)
	script.Parent.Black.Transparency = 0.5
	wait(0.1)
	script.Parent.Black.Transparency = 0.4
	wait(0.1)
	script.Parent.Black.Transparency = 0.3
	wait(0.1)
	script.Parent.Black.Transparency = 0.2
	wait(0.1)
	script.Parent.Black.Transparency = 0.1
	wait(0.1)
	script.Parent.Black.Transparency = 0


	wait(1)
	Camera.CameraType = Enum.CameraType.Custom
	script.Parent.PlayButton:Destroy()
	script.Parent.SettingsButton:Destroy()
	script.Parent.CreditsButton:Destroy()
	game.ServerStorage.Guis:Clone().Parent = game.Players.LocalPlayer.PlayerGui
	game.Players.LocalPlayer.Character.Humanoid.Walkspeed = 16


	-- Start the UnBlack tween
	script.Parent.Black.Transparency = 0.1
	wait(0.1)
	script.Parent.Black.Transparency = 0.2
	wait(0.1)
	script.Parent.Black.Transparency = 0.3
	wait(0.1)
	script.Parent.Black.Transparency = 0.4
	wait(0.1)
	script.Parent.Black.Transparency = 0.5
	wait(0.1)
	script.Parent.Black.Transparency = 0.6
	wait(0.1)
	script.Parent.Black.Transparency = 0.7
	wait(0.1)
	script.Parent.Black.Transparency = 0.8
	wait(0.1)
	script.Parent.Black.Transparency = 0.9
	wait(0.1)
	script.Parent.Black.Transparency = 1
end)