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

How to put a weapon in a player's backpack? (REPOSTED AND STILL UNANSWERED)

After this code, I need to put a weapon in a players backpack. How do I access the player's back pack, and how to I place the object there? Here is my script so far...

StarterGui.ScreenGui.Map1.Visible = Map1
player = game.Players:GetChildren() 
target = Vector3.new(-8, 9.8, -3) 
while true do
wait(30)
Map1 = true
wait(30)
Map1 = false

function fadeTo(a, b, c)
	for transparency = a, b, c do
	--go from a to b, counting by c

		for _, part in pairs(player.Character:GetChildren()) do
		--for each of the objects in the character,

			if part:IsA("BasePart") then
			--check if it's a part, and if so

				part.Transparency = transparency
				--set its transparency
			end
		end
		wait(0.1)
	end
end

fadeTo(0, 1, 0.1) --fade out,
player.Character.Torso.CFrame = target --teleport the player
fadeTo(1, 0, -0.1) --fade back in
end

While you're at it, does what I have so far look right?

1 comment

0

Help me please!

1 answer

To put a Tool or HopperBin in a players BackPack you would just do this :

tool.Parent = player.Backpack

There are two variables you need to fill in :

  • tool would be the Tool or HopperBin you want the player to get.
  • player the player that gets the tool. This must be the Player object.

If you have any questions, concerns or just need some help with this PM me on ROBLOX!

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