Hey, everybody!
Hope you’re having a good day, mine is fine!
I just can’t figure out how to make this !btools command work.
Concept:
When a user that is in a group, (rank 12 or over) states the command “!btools”, it will give them btools from the workspace.
Code:
local minrank = 12
local btools = game.Workspace["Building Tools"]
local Storage = game.Workspace
local ToolNames = {"Building Tools"}
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(Message)
if Message == "!btools" then
if player:GetRankInGroup(GroupID) >= minrank then
local Backpack = player:WaitForChild("Backpack")
for i = 1, #ToolNames do
local Tool = Storage:FindFirstChild(ToolNames[i])
if Tool then
end
end
end
end
end)
end)
I really need somebody to help me, I have been sitting here for ages trying to work out how!
Thank you,
Hope you’re having a nice day.
--[[
I fixed the code and added the cloning and parenting for you. Enjoy!
]]
local minrank = 12
local Storage = game:WaitForChild('ServerStorage')
local ToolNames = {"Building Tools"} -- Add tool names here, make sure they're in serverstorage. :)
local cmd = "!btools"
game.Players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(Message)
if string.sub(Message, 1, #cmd):lower() == cmd then
if player:GetRankInGroup(GroupID) >= minrank then
for _, v in pairs(Storage:GetChildren()) do
v:Clone().Parent = player:WaitForChild("Backpack")
end
end
end
end)
end)
I’ve tested this in my own place, and it works perfectly. Enjoy.