i need help making a command to give a tool
"when person says “/e give(tool) give person who said the command (tool)”
You seem to asking for code. The #help-and-feedback:scripting-support section is for help and feedback, not for getting people to give you code.
2 Likes
local players = game:GetService("Players")
local storage = game:GetService("ReplicatedStorage")
local gun = storage:WaitForChild("Gun") --example tool
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.match(msg, "/give [a-zA-Z]+ [%w_]+") then
local plrName = string.match(msg, "[%w_]+$")
local plr = players:FindFirstChild(plrName)
local toolName = string.gsub(msg, "/give ", "")
toolName = string.gsub(toolName, " [%w_]+$", "")
local toolClone = storage:FindFirstChild(toolName)
toolClone.Parent = plr:WaitForChild("Backpack")
end
end)
end)
https://gyazo.com/3623038bb5dad578007f2db38ac93b4b
/give [tool name] [user name]
Is how the command currently works, tools must be placed in the “ReplicatedStorage” folder.