I cannot call, clone, or set an items parent to the backpack

So, I have a server script located in ServerScriptService that clones a tool into the player’s Backpack, but I can’t get it to work.

local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	RS.GunStorage:FindFirstChild("AUG"):Clone().Parent = player.Backpack
end)

Any output?

You could also try waiting for the player’s backpack object to load, I can’t remember if that’s guaranteed to be existent when the PlayerAdded event is fired.

RS.GunStorage:FindFirstChild("AUG"):Clone().Parent = player:WaitForChild("Backpack")

Is it archivable?
(30 cr limit)

1 Like

Nvm I think I found your solution:

local clone = RS.GunStorage:FindFirstChild("AUG"):Clone()
clone.Parent = player:WaitForChild("Backpack")

This might be it, because maybe roblox is not recognising what the clone is.

I tried both yours and sharpies solutions and none fixed the issue.

I tried that too, but it still will not work. I feel like it could be a bug but I’m not sure.

If all you’re trying to do is make it so players spawn with a weapon, can you just drag the gun directly into the StarterGear folder?

If that doesn’t even do anything, then chances are the Archivable property is not enabled on the gun.

The Archivable property is enabled on the weapon. I’m not putting it in starterpack because I have multiple weapons.

Yes, the script is in ServerScriptService.

You can put it in replicated storage and use a local script? I don’t understand the purpose of doing it on the server, plus the server has more risk of getting exploited

If he did that, the weapon would not be seen on the server, so when ever the player wanted to use the gun, other players wouldn’t see it.

The tool needs to appear in the backpack on the server end for my other systems to work properly.

The script is more of an example of my problem, I have a weapon selector and I was going to have a .died event that would take the tools that a player had out of their backpack and into replicated storage.

Yeah, the backpack exists but Roblox doesn’t want to clone it. I can clone it to any other container inside of the player, but not the backpack.

I can replicate this on my end as well.

This is actually a really odd problem, could very possibly be an engine bug that just recently slipped through.

EDIT
Found a fix, it’s hacky, but works for some reason.

Yeah, this is really dumb, this is honestly what I expect from Roblox.

Adding a yield statement fixes the problem:

local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local sword = game.ReplicatedStorage.ClassicSword:Clone()
	
	task.wait(1)
	
	sword.Parent = player:WaitForChild("Backpack")
end)
2 Likes