-- Buttons

local sparklerButton = prizeGUI:WaitForChild("SparklerGeneric")
local exitButton = prizeGUI:WaitForChild("ExitButton")


local function exit()
	prizeGUI.Visible = false
end

local function openPrizeGUI()
	prizeGUI.Visible = true
end

local function openRedeem()
	prizeGUI.Visible = false
end

local function awardPrize(whichPrize)
	-- Check if backpack already has that sparkler
	local cloneObject = sparklerPrize:Clone()
	cloneObject.Parent = backpack
	
	-- MAybe equip it? 
	local character = player.Character or player.CharacterAdded:Wait()
	local humanoid = character:FindFirstChild("Humanoid") or character:WaitForChild("Humanoid")

	humanoid:EquipTool(cloneObject)
end

exitButton.MouseButton1Click:Connect(exit)

sparklerButton.MouseButton1Click:Connect(function()
	awardPrize()
end)

proximityPrize.Triggered:Connect(openPrizeGUI)

