Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

connect is not a valid member?

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)

2 comments

0

What is this for? A click?

0

Because a TextButton is not an event

1 answer

✓ Accepted answer

#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.

2 comments

0

Thank you! :) I derped so hard!! xD

0

lol, np

This discussion is preserved as it was. New answers, comments, and votes are closed.