Soo I have a UI that lists chattags that the player owns.
Looks like that - I want to detect when the equip button is clicked, but I don’t know how
Structure, the chattag “template” is cloned into ScrollingFrame and LocalScript is the main script
Soo I have a UI that lists chattags that the player owns.
Structure, the chattag “template” is cloned into ScrollingFrame and LocalScript is the main script
Detecting button clicks would mean using the Activated
event for GuiButtons (ImageButtons and TextButtons)
You can put something like this inside of the Equip button to listen for presses (Localscript)
script.Parent.Activated:Connect(function()
--Code to do when button is pressed
end)
If you can’t put it in the button, just change script.Parent
to where the button is located
That is a better idea than what I had
I’ll try it out and mark you as solved if it works
Why not do it where you clone the tag in?
For example:
for _, chattag in pairs(chattags) do
local t = template:Clone()
t.Text = chattag
t.Activated:Connect(function()
--do whatever you want
end)
end
Only requires 1 script, and you also get access to the variables you used when creating it.