This loop goes through every player in the game and makes a button for each player based on a template. Near the beginning you can see that I tried to disable the button and display the text “YOU” if the players username is the same as the username the button is showing (because you shouldn’t be able to invite yourself to a party) and whenever I playtest, it shows “YOU” but the button still works even though I made .Interactable false, what did I do wrong?
for _, player in game:GetService('Players'):GetPlayers() do
local template = inviteMenu.whole.ScrollingFrame.button_template:Clone()
template.Visible = true
template.Parent = inviteMenu.whole.ScrollingFrame
template.username.Text = player.Name
template.level.Text = player:WaitForChild('leaderstats').Level.Value
if template.username.Text == game.Players.LocalPlayer.Name then
template.invite_button.Text = 'YOU'
template.invite_button.Interactable = false
end
template.invite_button.Activated:Connect(function()
if #game.Players.LocalPlayer.Team:GetPlayers() == 6 then
template.invite_button.Interactable = false
template.invite_button.Text = 'FULL'
end
if cd == false then
cd = true
PartyInviteEvent:FireServer(player)
template.invite_button.Text = 'WAIT'
template.invite_button.Interactable = false
wait(1.5)
cd = false
template.invite_button.Text = 'INVITE'
template.invite_button.Interactable = true
end
end)
end