LOCAL
for i,instance in pairs (inventoryList:GetChildren()) do
if instance:IsA("ImageLabel") then
instance:Destroy()
end
end
local remote = game.ReplicatedStorage.Assets.Remotes.Remote
local guiFolder = game.ReplicatedStorage.Gui
remote:FireServer("GetPlayerData")
remote.OnClientEvent:Connect(function(data, dataType)
if dataType == "SendData" then
for key, value in pairs(spellModule) do
for dataKey, dataValue in pairs(data.Spells) do
if key == dataValue then
local invSpot = guiFolder.InventorySpot:Clone()
invSpot.Parent = inventoryList
invSpot.Name = value.Name
invSpot.Icon.Image = "rbxassetid://"..value.Image
invSpot.ItemValue.Value = key
local invHover = guiFolder.LoadoutEquip:Clone()
invHover.Parent = invSpot
invHover.Disabled = false
end
end
end
end
end)
end
SERVERSCRIPTSERVICE SCRIPT
local remoteEvent = game.ReplicatedStorage.Assets.Remotes.Remote
remoteEvent.OnServerEvent:Connect(function(player, datatype)
if datatype == "GetPlayerData" then
remoteEvent:FireClient(player, GetData(player), "SendData")
end
end)
My problem is that each time i click on the button that fires this function, it adds another.. RemoteEvent fire?- What i mean is; So i click it once, it works fine, it generates the Gui once, I click it again, and it generated 2 of the guis, I click it again, it generates 3, and so on.
How do I know its not just constantly adding more of the gui? Well, for one,,
if instance:IsA("ImageLabel") then
instance:Destroy()
end
Secondly,, I previously had the OnClientEvent print the table, and it would print 3 tables, so somehow it's multiplying itself..
How would i fix this?? I've never run into something like this..

1 comment
I am though, lines through 1-5.. also the fact that for a split second all the guis disappear, and then re-appear with 1 more