Backpack stays completely empty

Hi,
My code gives the player items when they join. For some reason, my backpack stays completely empty as of testing.
Here’s what I have:

print("Started")
game.Players.PlayerAdded:Connect(function(plr)
	print("1")
	local mss = game:GetService("MemoryStoreService")
	print("2")
	local data = mss:GetQueue(" "..tostring(plr.UserId), 30):ReadAsync(1)[1]
	print("3")
	if data ~= nil then
		print(data)
		print("4")
		for i, v in pairs(data) do
			print(tostring(v))
			print("\""..tostring(v).."\"")
			if game.Workspace:FindFirstChild(tostring(v)) then
				print("Item found.")
				local item = game.Workspace[tostring(v)]:Clone()
				print("Item cloned.")
				item.Parent = plr.Backpack
				print("Item moved.")
				print(plr.Name)
			end
		end
	end
end)

In the console, it prints:

1
2
3
table: random numbers and letters
4
AlmondWater
"AlmondWater"
Item found.
Item cloned.
Item moved.
TailsSlashMiles92

So everything is working, but nothing is actually in my backpack. What’s wrong?

1 Like

Parent the tool in the backpack everytime their character spawns/loads.

1 Like

i cant do it everytime, because then theyd have their items after they die and i dont really want that. would a wait(5) possibly work?

1 Like

why not you put them on replicated storage and create a clon, and when is used, you just destroy it?

1 Like

what…? (character limit eeeee)

Blud, why are u using workspace to store items

its not that big of a deal bro

It is. Either put them in serverstorage or replicated. Putting stuff thats meant to be cloned in workspace is a sin.

i dont understand why youre complaining about an item in a certain spot… but you do you… :+1: this conversation shouldnt even be happening

thats that i said, but not just that. thats just a best practice, but test your game and notice if the item apears in your backpack trough the explorer.

probably you didnt put the item with a tool part. or something that phisically isnt allowing to show the item to you

1 Like

sometimes the problem is in the explorer, or someting like that, send me a screenshot to know more

its fine i solved it. i made it so it waits until the character loads, similar to what @NyrionDev said. thanks anyway

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.