I’ve already tried moving it outside my packet function, but when the client loads, it creates a loop?! Thanks!
local CollectionService = game:GetService("CollectionService")
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Replicated_Assets = ReplicatedStorage.Assets
local Container = Replicated_Assets.Container
local Class = ReplicatedStorage.Class
local Packets = require(Replicated_Assets.Events.Packets)
local TweenInfoContainer = require(Container.TweenInfo)
local TypeContainer = require(Container.Types)
local ButtonClass = require(Class.Button)
local function CreateButton(button: TypeContainer.BaseButton)
local buttonObject = ButtonClass.new(button)
buttonObject:Active()
end
Packets.PlayerClient.listen(function()
for _, button: TypeContainer.BaseButton in CollectionService:GetTagged("ButtonTag") do
print("a") -- returning x16 but i put a tag in 6 object
CreateButton(button)
end
end)