Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

connect is not a valid member?

Asked by 8 years ago
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)
0
What is this for? A click? theCJarmy7 1293 — 8y
0
Because a TextButton is not an event theCJarmy7 1293 — 8y

1 answer

Log in to vote
1
Answered by
theCJarmy7 1293 Moderation Voter
8 years ago

That's not an event

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.
0
Thank you! :) I derped so hard!! xD TinyPanda273 110 — 8y
0
lol, np theCJarmy7 1293 — 8y
Ad

Answer this question