Cloning Problem

(repost because no replies)

As I try to make an inventory system, I happen to come across a problem related to cloning.

To put in simple terms, when I clone an object from replicated storage, it doesn’t clone 4 times, and only clones once. And yes, I have confirmed it’s actually cloning and not just changing the parent of the image.

There a four local scripts, which passes on the itemname, itemimage and itemstats towards the server script. The server script will then call the module script and the module script will then call the other module script involved.

4 local scripts:

local rt = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
rt:FireServer(game:GetService("Workspace"):WaitForChild("Laser1"), 0, "Laser1", "rbxassetid://9395657979", "funni" )
local rt = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
rt:FireServer(game:GetService("Workspace"):WaitForChild("Engine1"), 0, "Engine1", "rbxassetid://9396932804", "funni")
local rt = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
rt:FireServer(game:GetService("Workspace"):WaitForChild("Launcher1"), 5, "Launcher1", "rbxassetid://9396819222", "funni")

local rt = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
rt:FireServer(game:GetService("Workspace"):WaitForChild("Armor1"), 0, "Armor1", "rbxassetid://9397070100", "funni")

Server script:


local rt = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")
rt.OnServerEvent:Connect(function(plr, item, itemcost, itemname, itemimage, itemstats)
	local module = require(game:GetService("ServerScriptService"):WaitForChild("Buy"))
	module.insert(item, itemcost, plr.leaderstats.Cash, plr, itemname, itemimage, itemstats)
end)

Primary module script:

inventorysystem = {}
local inventory = {}
local insert = require(game:GetService("StarterGui"):WaitForChild("ScreenGui"):WaitForChild("ScrollingFrame"):WaitForChild("Insert"))
function inventorysystem.insert(item,price,cash,plr, itemname, itemimage, itemstats)
	if cash.Value >= price then
		cash.Value -= price
		table.insert(inventory, item.Int.Value)
		local value = table.find(inventory, item.Int.Value)
		local int = Instance.new("IntValue")
		int.Name = item.Name
		int.Value = value
		int.Parent = plr.Inventory
		print(value)
		insert.add(item, itemname, itemimage, itemstats)
	end
	
end
return inventorysystem

Secondary module script:


local insert = {}

local folder = script:WaitForChild("Folder")

local image = game:GetService("ReplicatedStorage"):WaitForChild("ItemImage"):Clone()

function insert.add(item, itemname, itemimage, itemstats)

image.Image = itemimage

image.Parent = script.Parent

image.ItemName.Text = itemname

image.ItemStats.Text = itemstats

end

return insert

Behaviour:

image

Expected behaviour:

image

Could someone actually help with this?(I’m going to school anyways now, cya)

dont use game:GetService("StarterGui") but use game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui")or loop each player

I forgot to tell you, a server script calls the module script.

image