How to make a part that gives tool when clicked on lua code example
Example: How to make a part that gives tool when clicked on lua
local ToolNames = {"Real Knife", "Real Knife", "Real Knife"}-----put name of the tool has to be exact exact name (remove the words items but not (") keep (")Between (" ") put item name for EX: "Glock 17"
local Storage = game:GetService("ServerStorage")----Put the tool item in serverstorage (cars,hats,and clothing will not work only tools work like guns and such)
local Part = script.Parent
local ClickDetector = Part:WaitForChild("ClickDetector")
ClickDetector.MouseClick:connect(function(Player)
if Player and Player.Character then
local Backpack = Player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
Tool:clone().Parent = Backpack
end
end
end
end)
---------Made BY Rigby#9052 on Discord