| |
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 30 Mar 2012 08:47 PM |
The "while wait() do" line is a good sign that you don't know what you're trying to do.
What are you trying to do? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
| 30 Mar 2012 11:31 PM |
| yes, the reason I will never respond helpfully is because your in a clan that nobody should care about on scripting helpers. |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2012 11:51 PM |
| Yup wont help a noob in that clan |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 12:08 AM |
local t = {} for _, v in pairs(game.Lighting:GetChildren()) do if v:IsA("Tool") or v:IsA("HopperBin") then table.insert(t, v) end end setmetatable(t, {__call = function(self, name) for _, v in pairs(self) do if name==v then return true end end return false end })
game.Workspace.DescendantAdded:connect(function(child) if not t(child.Name) and (child:IsA("Tool") or child:IsA("HopperBin)) then child:Destroy() end end)
game:GetService("RunService").Stepped:connect(function() for _, v in pairs(game.Players:GetPlayers()) do pcall(function() for _, V in pairs(v.Backpack:GetChildren()) do if not t(V) then V:Destroy() end end end) end end)
Try that. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:05 AM |
I believe there is a metamethod that can do that, little too tired to think straight at the moment. If nobody has answered by morning I can give you a definite answer.
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:08 AM |
Scratch the last post, decided to research it. What you will have to do is do a quick index of the table and the meta table. Then use the string.sub function to get the part of the string you need.
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:12 AM |
Assuming metatables are exactly the same as regular tables, that should work.
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:19 AM |
Here is a basic example, this basically creates the base table and inserts a metatable with just the string "lol" then we index the table and get the index and value. No worries, I do not always think straight when I'm tired either :3
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:20 AM |
Forgot the example :O
local t = {} setmetatable(t,{"lol"})
print(getmetatable(t))
for i,v in pairs(getmetatable(t)) do print(i,v) end
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
| |
|
Riderj
|
  |
| Joined: 15 Aug 2011 |
| Total Posts: 1534 |
|
|
| 31 Mar 2012 01:31 AM |
No problem.
[[ 9/10 - Scripting| 4/10 - Building | 10/10 - Confused ]] |
|
|
| Report Abuse |
|
|
|
| 31 Mar 2012 02:35 PM |
| I wouldn't use string.sub at all. Assuming you're changing the name of the gun, that in itself is a bad idea. Use a GUI to show ammo or something. |
|
|
| Report Abuse |
|
|