No script here before can have discord today!

--Made by ranny80


local gui = script.Parent


local player = game.Players.LocalPlayer

local replicatedstorage = game:GetService("ReplicatedStorage")
local statustag = replicatedstorage:WaitForChild("StatusTag")
local timertag = replicatedstorage:WaitForChild("TimerTag")
local statustitle = gui:WaitForChild("StatusTitle")
local event = replicatedstorage:WaitForChild("RemoteEvent")

local pointsvalue = player:WaitForChild("Points")
local multipliervalue = player:WaitForChild("Multiplier")
local emeraldswordvalue = player:WaitForChild("EmeraldSword")

local resultprompt = gui:WaitForChild("ResultPrompt")
local resultname = resultprompt:WaitForChild("ResultName")
local resultdesc = resultprompt:WaitForChild("ResultDescription")

local classprompt = gui:WaitForChild("ClassPrompt")
local classname = classprompt:WaitForChild("ClassName")
local classdesc = classprompt:WaitForChild("ClassDescription")

local pointslabel = gui:WaitForChild("PointsLabel")
local pointsbutton = pointslabel:WaitForChild("Button")
local pointstext = pointslabel:WaitForChild("DisplayText")

local bloxxerchance = gui:WaitForChild("BloxxerChance")
local bloxxerchancebutton = bloxxerchance:WaitForChild("Button")
local bloxxerchancetext = bloxxerchance:WaitForChild("DisplayText")

local emeraldswordbutton = gui:WaitForChild("EmeraldSwordButton")

local bloxxerchancewindow = gui:WaitForChild("BloxxerChanceWindow")
local bloxxerchancebuy = bloxxerchancewindow:WaitForChild("BuyButton")
local bloxxerchanceclose = bloxxerchancewindow:WaitForChild("XButton")

local emeraldswordwindow = gui:WaitForChild("EmeraldSwordWindow")
local emeraldswordbuy = emeraldswordwindow:WaitForChild("BuyButton")
local emeraldswordclose = emeraldswordwindow:WaitForChild("XButton")


function secondstotimer(seconds)
	local minutes = math.floor(seconds / 60)
	local remainingseconds = seconds % 60
	if remainingseconds <= 0 then
		remainingseconds = "00"
	elseif remainingseconds <= 9 then
		remainingseconds = "0" .. tostring(remainingseconds)
	else
		remainingseconds = tostring(remainingseconds)
	end
	return tostring(minutes) .. ":" .. remainingseconds
end

function updatestatus()
	if timertag.Value < 0  then
		statustitle.Text = statustag.Value
	else
		statustitle.Text = statustag.Value .. "  (" .. secondstotimer(timertag.Value) .. ")"
	end
	if statustag.Value == "Intermission" then
		statustitle.TextColor3 = Color3.new(203/255, 1, 1)
	elseif statustag.Value == "Match" then
		statustitle.TextColor3 = Color3.new(1, 1, 203/255)
	elseif statustag.Value == "Loading Map" or statustag.Value == "Waiting for Players" then
		statustitle.TextColor3 = Color3.new(203/255, 1, 203/255)
	end
end

timertag.Changed:connect(updatestatus)
statustag.Changed:connect(updatestatus)
updatestatus()


event.OnClientEvent:connect(function(...)
	local tuple = {...}
	if tuple[1] == "Result" then
		if tuple[2] == "BloxxerWin" then
			resultname.Text = "Mad Bloxxer Wins!"
			resultname.TextColor3 = Color3.new(1, 74/255, 77/255)
			resultdesc.Text = "All players were bloxxed."
		else
			resultname.Text = "Players Win!"
			resultname.TextColor3 = Color3.new(111/255, 149/255, 1)
			resultdesc.Text = "The Mad Bloxxer was captured."
		end
		resultprompt.Visible = true
		resultprompt.Position = UDim2.new(0, -400, .5, -92)
		resultprompt:TweenPosition(UDim2.new(.5, -170, .5, -92), "Out", "Quad", 1)
		wait(7)
		resultprompt:TweenPosition(UDim2.new(1, 60, .5, -92), "Out", "Quad", 1)
	elseif tuple[1] == "Class" then
		if tuple[2] == "Bloxxer" then
			classname.Text = "You are the Mad Bloxxer"
			classname.TextColor3 = Color3.new(1, 74/255, 77/255)
			classdesc.Text = "Your goal is to blox everyone!"
		elseif tuple[2] == "Sheriff" then
			classname.Text = "You are the Sheriff"
			classname.TextColor3 = Color3.new(111/255, 149/255, 1)
			classdesc.Text = "Your goal is to find the Mad Bloxxer and put them away for good!"
		else
			classname.Text = "You are a Bystander"
			classname.TextColor3 = Color3.new(117/255, 1, 156/255)
			classdesc.Text = "Help the Sheriff find the Mad Bloxxer."
		end
		classprompt.Visible = true
		classprompt.Position = UDim2.new(0, -400, .5, -92)
		classprompt:TweenPosition(UDim2.new(.5, -170, .5, -92), "Out", "Quad", 1)
		wait(7)
		classprompt:TweenPosition(UDim2.new(1, 60, .5, -92), "Out", "Quad", 1)
	end
end)


function updatepoints()
	pointstext.Text = pointsvalue.Value
end

pointsvalue.Changed:connect(updatepoints)
updatepoints()


function updatemultiplier()
	bloxxerchancetext.Text = "x " .. multipliervalue.Value
end

multipliervalue.Changed:connect(updatemultiplier)
updatemultiplier()


function updateemeraldsword()
	if emeraldswordvalue.Value == 0 then
		emeraldswordbuy.Visible = true
	else
		emeraldswordbuy.Visible = false
	end
end
emeraldswordvalue.Changed:connect(updateemeraldsword)
updateemeraldsword()


function closewindows()
	emeraldswordwindow.Visible = false
	bloxxerchancewindow.Visible = false
end

bloxxerchanceclose.MouseButton1Down:connect(closewindows)
emeraldswordclose.MouseButton1Down:connect(closewindows)


bloxxerchancebuy.MouseButton1Down:connect(function()
	event:FireServer("Buy", "BloxxerChance")
	closewindows()
end)

emeraldswordbuy.MouseButton1Down:connect(function()
	event:FireServer("Buy", "EmeraldSword")
	closewindows()
end)

pointsbutton.MouseButton1Down:connect(function()
	closewindows()
	event:FireServer("Buy", "100Points")
end)

bloxxerchancebutton.MouseButton1Down:connect(function()
	if bloxxerchancewindow.Visible then
		closewindows()
	else
		closewindows()
		bloxxerchancewindow.Visible = true
	end
end)

emeraldswordbutton.MouseButton1Down:connect(function()
	if emeraldswordwindow.Visible then
		closewindows()
	else
		closewindows()
		emeraldswordwindow.Visible = true
	end
end)