Help With Cloning

  1. I need to fix this script to make it clone cards before inserting them into the backpack.

  2. Right now, it’s not cloning them and therefore only one card is available to be given per server.

Script here:

game.ReplicatedStorage.GivePlayerItem.OnServerEvent:Connect(function(Player, PlayerName)
	local ToolToGive = game.ReplicatedStorage.Card
	ToolToGive.Parent = game.Players[PlayerName].Backpack
end)

Any help would be greatly appreciated as I’m having a bit of a dilemma as of right now!

1 Like

You simply forgot to add the :Clone() function into your code:

game.ReplicatedStorage.GivePlayerItem.OnServerEvent:Connect(function(Player, PlayerName)
	local ToolToGive = game.ReplicatedStorage.Card:Clone()
	ToolToGive.Parent = game.Players[PlayerName].Backpack
end)

Also backpack is the storage for items that are accessed using the ` key. If you want the cards to go immediately into the hotbar you can insert it into the player’s character.

2 Likes

Thank you omg, you may have just saved me ahah!