Trying to make a prompt appear

so far the script works well but when i click “no” then i try to click a player slot again the prompt doesnt show up vid below! i know theres extra stuff involved but im not sure how to approach this. ty!

script:

--if a player slot was clicked
		templateClone.MouseButton1Click:Connect(function()
			if selectedButton == templateClone then return end
			if selectedButton then
			selectedButton.BackgroundColor3 = unselectedColor -- Reset the current selected button's color
		end

			templateClone.BackgroundColor3 = templateClone and selectedColor or unselectedColor
			selectedButton = templateClone -- Rewrite the selectedButton

if templateClone and templateClone.BackgroundColor3 == selectedColor then
	local plrchoiceUI = script.Parent.plrChoiceUI
	plrchoiceUI.Enabled = true
				plrchoiceUI.Frame.question.Text = "Are you sure you would like to loopkill "..templateClone.Text.."?"
end
		end)
		
		-- the no button on the prompt
		no.MouseButton1Click:Connect(function()
			plrchoiceUI.Enabled = false
		end)

Could you potentially show a bit more of the script?

1 Like

yes sorry!

local template = game.ReplicatedStorage.plrName
local plrs = game:GetService("Players")
local unselectedColor = Color3.fromRGB(199, 199, 199) -- grey/white
local selectedColor = Color3.fromRGB(97, 255, 62) -- Green
local yes = script.Parent.plrChoiceUI.Frame.yes
local no = script.Parent.plrChoiceUI.Frame.no
local plrchoiceUI = script.Parent.plrChoiceUI
local selectedButton -- Stores the button you clicked on

function updPlrs()
	local plr = game.Players.LocalPlayer
	local thumbnailtype = Enum.ThumbnailType.HeadShot
	local thumbnailsize = Enum.ThumbnailSize.Size420x420

	for i, p in pairs(game.Players:GetPlayers()) do
		if (script.Parent.plrScroll:FindFirstChild(p.Name)) then continue end
		local thumbnail = plrs:GetUserThumbnailAsync(p.UserId, thumbnailtype, thumbnailsize)

		local templateClone = template:Clone()
		templateClone.Name = p.Name
		templateClone.Visible = true
		templateClone.Text = p.Name
		templateClone.displayName.Text = "@"..p.DisplayName
		templateClone.PFP.Image = thumbnail
		templateClone.Parent = script.Parent.plrScroll

--if a player slot was clicked
		templateClone.MouseButton1Click:Connect(function()
			if selectedButton == templateClone then return end
			if selectedButton then
			selectedButton.BackgroundColor3 = unselectedColor -- Reset the current selected button's color
		end

			templateClone.BackgroundColor3 = templateClone and selectedColor or unselectedColor
			selectedButton = templateClone -- Rewrite the selectedButton

if templateClone and templateClone.BackgroundColor3 == selectedColor then
	local plrchoiceUI = script.Parent.plrChoiceUI
	plrchoiceUI.Enabled = true
				plrchoiceUI.Frame.question.Text = "Are you sure you would like to loopkill "..templateClone.Text.."?"
end
		end)
		
		-- the no button on the prompt
		no.MouseButton1Click:Connect(function()
			plrchoiceUI.Enabled = false
		end)
		
end
end

function removeSlot(plr)
	for i, child in pairs(script.Parent.plrScroll:GetChildren()) do
		if child.Name == plr.Name then
			child:Destroy()
		end
	end
end

updPlrs()
game.Players.PlayerAdded:Connect(updPlrs)
game.Players.PlayerRemoving:Connect(removeSlot)
1 Like

Why don’t you try changing the BackgroundColor here

So it would look like this instead:

no.MouseButton1Click:Connect(function()
   plrchoiceUI.Enabled = false
   selectedButton.BackgroundColor3 = unselectedColor
end)
1 Like

hey man, thanks for ur reply.

funny enough i actually did try this and while it does go grey again, it wont work when i click it to go green again. great idea tho. i dont have a debounce in this line:

	`templateClone.MouseButton1Click:Connect(function()`

but i was going to. i just dont know how to connect it up really.

7654f5772aaedc2217f8d7f13468189a

1 Like

Maybe you could just check if plrChoiceGui is enabled instead?

1 Like

oh for gods sake i figured it out. im so tired :sob:

i had to take out the return statement:
if selectedButton == templateClone then return end

thank u so much 4 ur help tho! :smiley:

1 Like