Hi, I am trying to make a button using the collection service. I have already got the base button working where I can clone a model into the workspace from replicated storage (These are physical buttons btw not UI).
The problem is, When I use one button to spawn in another button, The new button does not work.
Keep in mind that all the buttons have been tagged for collection service
Here is an examples of what exactly im making:
Here is what my code looks like: I have left out some functions that are unrelated
local CollectionService = game:GetService("CollectionService")
local buttons = CollectionService:GetTagged("Button")
for _,button in pairs(buttons) do
coroutine.wrap(function()
local debounce = false
button.PrimaryPart.Touched:Connect(function()
if not debounce then
debounce = true
print("E")
EventsFolder.PlaceEvent:FireServer(button.SettingsFolder.Building.Value,button)
button:Destroy()
end
end)
end)()
end
One solution I came up with was to clone the button to the workspace and retag the buttons but that did not work.