Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I give user's tools by entering their username and clicking the tool?

Asked by
Zvtu 4
5 years ago

So, I have a about 5 tools I want to be able to do this with. I wrote this code as a short example of what will happen when the username is typed in and a tool is clicked. (Example: Shotgun)

local p = game.Players.LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
    local tool = script.Parent.Shotty:Clone()
    tool.Parent = p.Backpack
end)

The thing is I don't know how to go about telling a script to get a player's user and give them a tool. Can someone help me please? Thank you.

Answer this question