Colors only applying on gui once?

I want to make a system which puts you in a queue of people who’s avatar’s will be rendered on a giant dummy with an optional developer product to put you ahead of line and another one for killing people. The developer products change the color of the textbox.

Whenever I buy one of the developer products it changes color of the textbox and then back after used, although when I buy the developer product again it doesn’t apply the colors.

In the video you can see that the color for the textbox only applies the first time the developer product is bought.

I’ve tried looking on the devforums and tinkering with the scripts.

I’ve noticed that it only happens if your purchasing the same developer product, if you lets say buy priority and then sabotage, priority will then give its gold color although it has already been bought before and vice versa.

Here are the scripts.

Textbox input script:

local MPS = game:GetService("MarketplaceService")
local PF = script.Parent.Parent.Parent.Priority
local db = false
local a = script.Parent.Parent.BackgroundColor3
local b = script.Parent.Parent.CornerBG.ImageColor3
local c = script.Parent.Parent.Corner.ImageColor3
local d = script.Parent.Parent.TextBox.BackgroundColor3

script.Parent.FocusLost:Connect(function(entered)
	if entered then
		local result = game.ReplicatedStorage.LoadUser:InvokeServer(script.Parent.Text)
		
		if result.Success then
			
			script.Parent.Parent.Success:Play()
			
			script.Parent.Parent.BackgroundColor3 = a
			script.Parent.Parent.CornerBG.ImageColor3 = b
			script.Parent.Parent.Corner.ImageColor3 = c
			script.Parent.Parent.TextBox.BackgroundColor3 = d
		else
			script.Parent.Parent.Fail:Play()
			script.Parent.PlaceholderColor3 = Color3.fromRGB(222, 22, 26)
			script.Parent.Text = ""
			if result.CooldownTimeRemaining then
				local roundedTime = math.floor(result.CooldownTimeRemaining + 0.5)
				script.Parent.PlaceholderText = "Cooldown: " .. roundedTime
			end
			wait(1.5)
			script.Parent.PlaceholderColor3 = Color3.fromRGB(150, 150, 150)
			script.Parent.PlaceholderText = "Insert Username of Player here!"
		end
	end
end)

PF.TextButton.MouseButton1Click:Connect(function()
	MPS:PromptProductPurchase(game.Players.LocalPlayer, 1188293547)
end)

ServerHandler script:

local MPS = game:GetService("MarketplaceService")

local cooldownTime = 30 --In seconds

local queue = {}

local cooldown = {} --ignore

local priority = {} --ignore

local kira = {} --ignore

local duration


game.Players.PlayerAdded:Connect(function(player)
	cooldown[player.UserId] = {Time = 0}
	priority[player.UserId] = false
end)

game.Players.PlayerRemoving:Connect(function(player)
	cooldown[player.UserId] = nil
	priority[player.UserId] = nil
end)

game.ReplicatedStorage.LoadUser.OnServerInvoke = function(player, user)
	local timePassed = (tick()-cooldown[player.UserId].Time)

	if not (timePassed >= cooldownTime) then
		print(timePassed)
		return {Success = false, Error = nil, CooldownError = true, CooldownTimeRemaining = cooldownTime - timePassed}
	end


	local id = nil

	local success, bad = pcall(function()
		id = game.Players:GetUserIdFromNameAsync(user)
	end)

	if success then
		if kira[player.UserId] then
			kira[player.UserId] = false
			local target = game.Players:GetPlayerByUserId(id)
			local suc, oop = pcall(function()target.Character:WaitForChild("Humanoid").Health = 0 end)
			return {Success = suc, Error = oop, CooldownError = false}
		end
		local info = nil
		local infoSuccess, infoError = pcall(function()

			info = game.Players:GetHumanoidDescriptionFromUserId(id)
			info.WidthScale = 35
			info.HeightScale = 35
			info.HeadScale = 35
			info.DepthScale = 35
			info.WidthScale = 35
		end)

		if not infoSuccess then
			warn(infoError)
			return {Success = false, Error = infoError, CooldownError = false}
		end

		local icon = nil
		local isReady = nil
		local iconSuccess, iconError = pcall(function()
			icon, isReady = game.Players:GetUserThumbnailAsync(id, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size100x100)
		end)

		if not iconSuccess then
			warn(iconError)
			return {Success = false, Error = iconError, CooldownError = false}
		end
		
		local sec = 90
		
		if MPS:UserOwnsGamePassAsync(player.UserId, 19611273) then
			sec *= 2
		end

		if priority[player.UserId] then
			local pt = {} --priority queue table
			local t = {} --normal queue table table
			
			for i, v in ipairs(queue) do
				if v.Priority then
					table.insert(pt, #pt+1, v)
				else
					table.insert(t, #t+1, v)
				end
			end
			
			queue = {{Name = user, Id = id, Requester = player.Name, Time = sec, Info = info, Icon = icon, Priority = true}, unpack(queue)}
			--queue = {unpack(pt), {Name = user, Id = id, Requester = player.Name, Time = sec, Info = info, Icon = icon, Priority = true}, unpack(t)} --this is what the could should look like and what it looks like in my head
			
			priority[player.UserId] = false
		else
			table.insert(queue, #queue+1, {Name = user, Id = id, Requester = player.Name, Time = sec, Info = info, Icon = icon, Priority = false})
		end
		game.ReplicatedStorage.UpdateQueue:FireAllClients(queue)

		cooldown[player.UserId].Time = tick()

		return {Success = true , CooldownError = false}
	else
		warn(bad)
		return {Success = false, Error = bad, CooldownError = false}
	end
end

MPS.ProcessReceipt = function(info)
	if info.ProductId == 1188293547 then
		local player = game.Players:GetPlayerByUserId(info.PlayerId)
		if not player then
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end

		priority[info.PlayerId] = true
		
		player.PlayerGui.InputGui.TextBoxHolder.Success:Play()
		
		repeat
			player.PlayerGui.InputGui.TextBoxHolder.BackgroundColor3 = Color3.new(0.658824, 0.47451, 0.0117647)
			player.PlayerGui.InputGui.TextBoxHolder.CornerBG.ImageColor3 = Color3.new(0.658824, 0.47451, 0.0117647)
			player.PlayerGui.InputGui.TextBoxHolder.Corner.ImageColor3 = Color3.new(0.827451, 0.690196, 0.00784314)
			player.PlayerGui.InputGui.TextBoxHolder.TextBox.BackgroundColor3 = Color3.new(0.827451, 0.690196, 0.00784314)
			wait()
		until player.PlayerGui.InputGui.TextBoxHolder.TextBox.BackgroundColor3 == Color3.new(0.827451, 0.690196, 0.00784314)

		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
	if info.ProductId == 1188314383 then
		local player = game.Players:GetPlayerByUserId(info.PlayerId)
		if not player then
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
		
		kira[info.PlayerId] = true
		
		player.PlayerGui.InputGui.TextBoxHolder.Success:Play()

		player.PlayerGui.InputGui.TextBoxHolder.BackgroundColor3 = Color3.new(0.513725, 0, 0.00784314)
		player.PlayerGui.InputGui.TextBoxHolder.CornerBG.ImageColor3 = Color3.new(0.513725, 0, 0.00784314)
		player.PlayerGui.InputGui.TextBoxHolder.Corner.ImageColor3 = Color3.new(0.792157, 0, 0.0117647)
		player.PlayerGui.InputGui.TextBoxHolder.TextBox.BackgroundColor3 = Color3.new(0.792157, 0, 0.0117647)

		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

while wait() do
	if queue[1] then
		workspace.RideInto.Humanoid:ApplyDescription(queue[1].Info)
		workspace.RideInto.Head.CanCollide = false
		id2 = game.Players:GetUserIdFromNameAsync(queue[1].Name)
		workspace.DisplayPart.SurfaceGui.TextLabel.Text = ("Now displaying <"..queue[1].Name..">")
		workspace.DisplayPart.SurfaceGui.ImageLabel.Image = game.Players:GetUserThumbnailAsync(id2, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420)

		duration = queue[1].Time

		table.remove(queue, 1)
		game.ReplicatedStorage.UpdateQueue:FireAllClients(queue)
		game.ReplicatedStorage.UpdateCountdown:FireAllClients(duration)
		wait(duration)
	end
end