22:49:25.009 - connect is not a valid member of TextButton 22:49:25.016 - Script 'Players.Player1.PlayerGui.PlayerHUD.bg.PlayerListUpdater', Line 82 22:49:25.018 - Stack End
So, this one threw me for a loop. I don't know how or why.. :/
But here's code.
newSlot.ActivityList.ToggleFriend:connect(function() if activityDebounce == 0 then activityDebounce = 1 if newSlot.ActivityList.ToggleFriend.Text == "Add Friend" then _G.output(player.Name, "sent friend request to", newSlot.Text) requestFriend:InvokeServer(newSlot.Text) else _G.output(player.Name, "is no longer friends with", newSlot.Text) removeFriend:InvokeServer(newSlot.Text) end local friend = isFriend:InvokeServer(newSlot.Text) _G.output(player.Name, friend) if friend then newSlot.ActivityList.ToggleFriend.Text = "Remove Friend" else newSlot.ActivityList.ToggleFriend.Text = "Add Friend" end activityDebounce = 0 end end)
Events work like this.
part.Event:connect(function() end)
And you got that right, but a TextButton is not an event. There are many events for TextButtons, the most common one(that I use) is MouseButton1Click
.
textButton.MouseButton1Click:connect(function() --do your code end)
Events can also be used like this.
function stuff() print"clicked" end textButton.MouseButton1Click:connect(stuff) --I don't like this way though, so I don't use it.