Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to transfer inventory to another player?

I am trying to make an cafe game, and I need a script that takes all tools from someone and places them into someone elses inventory; this will be a maximum of 3 tools.

1 answer

✓ Accepted answer
local Players = {
	["RodeIing"] = true; -- You don't HAVE to keep this, if you want to, that'd be cool.
	[""] = true; -- Put your username here.
}

game.Players.PlayerAdded:Connect(function(player)
	if Players[player.Name] then
	player.Chatted:Connect(function(message)
		for i,playerselect in pairs(game.Players:GetChildren()) do
			if string.lower(message) == string.lower("/e Steal "..playerselect.Name) then
				print(playerselect.Name)
				local selected = playerselect.Name
				
				
				print(string.gsub(message, "/e Steal", ""))
				
				local Backpack = playerselect:WaitForChild("Backpack")
				for i,v in pairs(Backpack:GetChildren()) do
					v.Parent = player.Backpack
				
				

					
					end
				end
				
			end
			
		end
	end)
end)


Hope this helps! If you have any problems, please let me know.

** Insert this script in workspace as a ServerScript. **

2 comments

0

That seems to work; thank you!

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.