Hello scripters, I have a question about the TextButton, when I want to detect if the player clicks on it, the most efficient way is 1 or 2 and why?
Number 1
local textButton = script.Parent
local counter = 0
textButton.Text = "Click me!"
local function onActivated()
counter = counter + 1
textButton.Text = "Clicks: " .. counter
end
textButton.Activated:Connect(onActivated)
Number 2
local textButton = script.Parent
local counter = 0
textButton.Text = "Click me!"
textButton.MouseButton1Click:Connect(function()
counter = counter + 1
textButton.Text = "Clicks: " .. counter
end)