omgninja1
|
  |
| Joined: 15 Feb 2012 |
| Total Posts: 95 |
|
|
| 27 Jun 2017 08:43 AM |
Is their something that will only allow a character to have a max of [3] accessories on? (Will Pay)
|
|
|
| Report Abuse |
|
|
omgninja1
|
  |
| Joined: 15 Feb 2012 |
| Total Posts: 95 |
|
| |
|
|
| 27 Jun 2017 08:55 AM |
You can easily make them.
local numAccessories = 0 game.Players.PlayerAdded:connect(function (player) repeat wait() until player.Character ~= nil player.CharacterAdded:connect(function (character) for _, v in pairs(character:GetChildren()) do if v:IsA("Accessory") then numAccessories = numAccessories + 1 end end if numAccessories > 3 then for _, v in pairs(character:GetChildren()) do if _ > 3 then if v:IsA("Accessory") then v:Destroy() end end end end end) end)
I don't know if this works or if this is as efficient, but this is what I came up with on the spot.
|
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 09:36 AM |
local function b(v) if v.className=='Accessory'then wait()v:destroy()end end local function a(char)wait(.6) char.ChildAdded:connect(b) end Game:service'Players'.PlayerAdded:connect(function(plr) local char=plr.Character;if char then a(char)end plr.CharacterAdded:connect(a) end) |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 09:39 AM |
| local function b(v) if v.className=='Accessory'then wait() local c=0;for i,v in ipairs(v.Parent:children())do if v.className=='Accessory'then ######### end if c>3 then v:destroy()end;end end local function a(char)wait(.6) char.ChildAdded:connect(b) end Game:service'Players'.PlayerAdded:connect(function(plr) local char=plr.Character;if char then a(char)end plr.CharacterAdded:connect(a) end) |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 09:40 AM |
local function b(v) if v.className=='Accessory'then wait() local count=0;for i,v in ipairs(v.Parent:children())do if v.className=='Accessory'then count=count+1;end end if c>3 then v:destroy()end;end end local function a(char)wait(.6) char.ChildAdded:connect(b) end Game:service'Players'.PlayerAdded:connect(function(plr) local char=plr.Character;if char then a(char)end plr.CharacterAdded:connect(a) end) |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 09:41 AM |
| That'll destroy every accessory... |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 09:41 AM |
| Nvm, didn't see newest posts |
|
|
| Report Abuse |
|
|
omgninja1
|
  |
| Joined: 15 Feb 2012 |
| Total Posts: 95 |
|
|
| 27 Jun 2017 10:32 AM |
I want everything removed if you have more than 3 hats+Accessories in total
|
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 10:33 AM |
local numAccessories = 0 game.Players.PlayerAdded:connect(function (player) repeat wait() until player.Character ~= nil player.CharacterAdded:connect(function (character) for _, v in pairs(character:GetChildren()) do if v:IsA("Accessory") then numAccessories = numAccessories + 1 end end if numAccessories > 3 then for _, v in pairs(character:GetChildren()) do if v:IsA("Accessory") then v:Destroy() end end end end) end) |
|
|
| Report Abuse |
|
|
|
| 27 Jun 2017 10:35 AM |
local function b(v) if v.className=='Accessory'or v.className=='Hat'then wait() local count=0;for i,v in ipairs(v.Parent:children())do if v.className=='Accessory'or v.className=='Hat'then count=count+1;end end if count>3 then for i,v in ipairs(v.Parent:children())do if v.className=='Accessory'or v.className=='Hat'then v:destroy()end end end;end end local function a(char)wait(.6) char.ChildAdded:connect(b) end Game:service'Players'.PlayerAdded:connect(function(plr) local char=plr.Character;if char then a(char)end plr.CharacterAdded:connect(a) end) |
|
|
| Report Abuse |
|
|
omgninja1
|
  |
| Joined: 15 Feb 2012 |
| Total Posts: 95 |
|
| |
|