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)
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)
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: