--[[

		SCRIPT VERSION:
			1.3, 10/19/21
		
		CURRENT ISSUE:
			Nothing
		
--]]


if not game.Loaded or not workspace:FindFirstChild("Terrain") then
	game.Loaded:Wait();
	game:GetService("Players").LocalPlayer.CharacterAdded:Wait();
end;

local Players = game:GetService("Players")
local Player = Players.LocalPlayer;

local Screen = script.Parent.Parent.Leveled.Admin;
local Sidebar = Screen.Sidebar.Inside;

function Animate(Instance, Time, Style, Direction, Animation, WaitForAnimation)
	game:GetService("TweenService"):Create(Instance, TweenInfo.new(Time, Style, Direction, 0, false, 0), Animation):Play();
	if WaitForAnimation == true then
		wait(Time);
	end;
end;

for Int, Button in pairs(Sidebar:GetChildren()) do
	if Button:IsA("ImageButton") then
		Button.MouseButton1Click:Connect(function()
			if Screen:FindFirstChild(Button.Name).Visible == true then
				Screen:FindFirstChild(Button.Name).Visible = false;
				Button.ImageColor3 = Color3.fromRGB(120, 120, 125);
				return;
			end;
			
			local WantScreen = Screen:FindFirstChild(Button.Name);
			for Int, Ue1 in pairs(Screen:GetChildren()) do
				if Ue1.Name ~= "Sidebar" then
					Ue1.Visible = false;
					Sidebar:FindFirstChild(Ue1.Name).ImageColor3 = Color3.fromRGB(120, 120, 125);
				end;
			end;
			WantScreen.Visible = true;
			Button.ImageColor3 = Color3.fromRGB(255, 255, 255);
		end);
	end;
end;
