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

How to make a System That Makes a Player Able To Give Another Player a Tool Without dropping it?

I Have Been Working On A Project And I Cant Find How I Would Be Able To Create a System Where A player can give another player a tool

2 answers

✓ Accepted answer

You can simply switch the Parent of the tool like this

local Tool = script.Parent
Tool.Parent = -- Refer to the other player here

Here is an example using that line

local Player = game.Players.LocalPlayer
local Tool = script.Parent
local Mouse = Player:GetMouse()

Mouse.Button1Down:Connect(function()
	local Target = Mouse.Target
	
	if Target:IsA("BasePart") and Target.Parent.Humanoid then
		Tool.Parent = Target
	end
end)

Take the tool and parent it to the other player.

Whenever a player has a tool equipped, it's found in their Character, which is how I tell what tool a player is currently using.

local tool = player1.Character.(the tool's name)
tool.Parent = player2.Character

2 comments

0

Alternatively, you could parent it to player2's Backpack if you want it in their inventory rather than it to be equipped

0

Yeah, I just assumed the questioner wanted player2 to immediately gain it. But if that's what they're going for they can do that ye

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