--------------------------------


local text

Event.OnClientEvent:Connect(function()
	game.Lighting.Blur.Enabled = true
	script.Parent.Frame.Visible = true
	PopSound:Play()
end)

EditBox.FocusLost:Connect(function(enterPressed)
	if enterPressed then
		text = tostring(EditBox.Text)
	end
end)

SubmitButton.Activated:Connect(function()
	text = tostring(EditBox.Text)
	if text ~= nil and text ~= "" and text ~= " " and string.len(text) < 150 then
		Event:FireServer(text)

		game.Lighting.Blur.Enabled = false
		script.Parent.Frame.Visible = false
		Notification:FireServer("Successfully Edited Stand!")
	end
end)

CancelButton.Activated:Connect(function()
	game.Lighting.Blur.Enabled = false
	script.Parent.Frame.Visible = false
	CancelSound:Play()
end)


UnclaimButton.Activated:Connect(function()
	game.ReplicatedStorage.Events.Unclaim:FireServer(player)
	game.Lighting.Blur.Enabled = false
	script.Parent.Frame.Visible = false
	Notification:FireServer("Successfully Unclaimed Stand!")
end)

RefreshButton.Activated:Connect(function()
	game.ReplicatedStorage.Events.Refresh:FireServer(player, Booth)
	game.Lighting.Blur.Enabled = false
	script.Parent.Frame.Visible = false
	Notification:FireServer("Successfully Refreshed Stand!")
end)

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventsFolder = ReplicatedStorage:FindFirstChild("Events")

local EditPromptEvent = EventsFolder:FindFirstChild("EditPlot")


EditPromptEvent.OnClientEvent:Connect(function(plot, value)
	if value == true then
		Booth = plot
		workspace.Stands[plot].Proximity.Attachment.EditPrompt.Enabled = true
		EditPrompt = workspace.Stands[plot].Proximity.Attachment.EditPrompt
		workspace.Stands[plot].Part.BillboardGui.Enabled = true
	else
		workspace.Stands[plot].Proximity.Attachment.EditPrompt.Enabled = false
		EditPrompt = nil
		workspace.Stands[plot].Part.BillboardGui.Enabled = false
	end
end)
