local plr = game.Players.LocalPlayer
local tool = workspace.Tool
tool.Parent = plr
how would i give a tool to a player?
2 answers
local plr = game.Players.LocalPlayer
local tool = workspace.Tool
tool.Parent = plr.Backpack
There is something name Backpack in the player. Use plr.Backpack to target it.
You can't give tools to players in a LocalScript.
You'll need to do this in a server script.
local Tool = game:GetService("ServerStorage"):WaitForChild("Tool")
game.Players.PlayerAdded:Connect(function(Player)
local clone = Tool:Clone()
Tool.Parent = Player.Backpack
end)
This script clones a tool, stored in ServerStorage into a Player's Backpack when they join the game. When they die, they will not get this tool again. If you want that to happen, put it in the Player's StarterGear.
This example is to demonstrate how to give it to a specific player. And I want to point out that you made an attempt to give the tool to this one player, without cloning it. Unless you want this player to be the only player to have the tool, clone it first, so you can use it in the future.
Edit: I see that someone has answered your question, but I want this to serve as a way to inform you of more than just knowing how to put a tool in a player's backpack, but some good rules of thumb, and also to tell you that you're doing this all in a LocalScript.
This discussion is preserved as it was. New answers, comments, and votes are closed.
