|
| 26 Dec 2016 11:38 AM |
500 R$ right now for anyone that can make a script to limit the number of tools someone has.
The goal is to prevent duplication of tools, not to limit the exact amount. Limit someone from having a certain number of any one type of tool (specifically a tool called "AR2") rather than actually limit the number of tools allowed in someone's inventory.
Thanks! |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2016 11:41 AM |
b1 Please reply to this if you are working on it.
Make a model with the script and a t-shirt for 500R$ when done. |
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 26 Dec 2016 11:42 AM |
-- Local Script in StarterPlayerScripts or StarterGui
local Players = game:GetService("Players") local Player = Players.LocalPlayer local Backpack = Player:WaitForChild("Backpack")
local function LimitTool(toolName)
Backpack.ChildAdded:connect(function(childObj) if childObj.Name == toolName then childObj:Destroy() else print(childObj.Name.." added to "..Player.Name.."'s backpack, but not 'AR2'") end end)
end
LimitTool("AR2") |
|
|
| Report Abuse |
|
|
|
| 26 Dec 2016 11:42 AM |
done
print("no)
cow goes moo |
|
|
| Report Abuse |
|
|
| |
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 26 Dec 2016 11:47 AM |
I totally forgot about limiting the number of AR2, I just made it impossible to get an AR2 lol... Here:
local Players = game:GetService("Players") local Player = Players.LocalPlayer local Backpack = Player:WaitForChild("Backpack")
local function GetNumAR2() local AR2 = {} for i, obj in pairs(Backpack:GetChildren()) do if obj.Name == "AR2" then table.inser(obj, AR2) end end return (#AR2) end
local function LimitTool(maxQuantity) Backpack.ChildAdded:connect(function(childObj) if childObj.Name == "AR2" and GetNumAR2() >= maxQuantity then childObj:Destroy() else print(childObj.Name.." added to "..Player.Name.."'s backpack, but not 'AR2'.") end end) end
LimitTool(1) -- Makes it so you can only have 1 AR2 |
|
|
| Report Abuse |
|
|
GGGGG14
|
  |
| Joined: 29 Jan 2012 |
| Total Posts: 25344 |
|
|
| 26 Dec 2016 11:47 AM |
-- should be table.insert(obj, AR2)
I typo'd |
|
|
| Report Abuse |
|
|
|
| 27 Dec 2016 12:01 PM |
| Make a t-shirt? I appreciate it a lot. |
|
|
| Report Abuse |
|
|