Alright, this is hard to comprehend but I'll try to the best of my abilities to explain it. So, essentially I wanted something based off NBA 2K, where there is a basketball court, and 6 spots per court. 3 for each team, as people get on the spots they have a GUI show up that says "Join spot" so that they can get next in line to play on the court for the next game.

I have the on-touch GUI working to the point where everything is OK besides there's this thing that it removes from my PlayerGUI back and fourth a lot and bugs out. I'd get on the spot and it would disappear and reappear 20 times a second and there's also a predicament where if I stand still, the GUI doesn't show even though I am still on/in the block in which is suppose to trigger it on touched.

I tried adding wait(3) and wait(2) to try to slow the script down and prevent this but it keeps happening. Here's the script:

(Don't mind the middle part. It's just to color the GUI to the color of the spot's team they are trying to join, red or blue)

local Gui = game.Lighting.EnterBlueSpot

function GiveGui(Player)
	if Player.PlayerGui:FindFirstChild(Gui.Name)~=nil then return end
		Gui:Clone().Parent=Player.PlayerGui
		wait(2)
	end

	local Player=game.Players:GetPlayerFromCharacter(hit.Parent)

	if Player==nil then return end

	GiveGui(Player)

	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Frame.BackgroundColor3 = Color3.new(0,255,255)
	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Frame2.BackgroundColor3 = Color3.new(0,255,255)
	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Corner.ImageColor3 = Color3.new(0,255,255)
	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Corner2.ImageColor3 = Color3.new(0,255,255)
	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Corner3.ImageColor3 = Color3.new(0,255,255)
	Player.PlayerGui.EnterSpot.RoundedButtonThing.RoundedBG.Corner1.ImageColor3 = Color3.new(0,255,255)
end)

script.Parent.TouchEnded:connect(function(hit)
	wait(3)
	local Player=game.Players:GetPlayerFromCharacter(hit.Parent)
	if Player==nil then return end

	Player.PlayerGui.EnterBlueSpot:Destroy()
end)