Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 19 Nov 2013 07:38 PM |
How would I make it so when a player touches a button the script checks to see if the player is in the table specified?
Here is a chunk of the script that i'm talking about:
function breakGame(hit) local humanoid = hit.Parent:findFirstChild("Humanoid") if (humanoid ~= nil) then local player = game.Players:GetPlayerFromCharacter(hit.Parent) if (_G.addedPlayers(player) == true) then
Before you say there is no table, yes there is. The table is in another script, hence the "_G.". Anyways, It doesn't work since I have no clue how to make it work. I tried to give it my best shot but nothing. Any help? |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2013 07:41 PM |
setmetatable(_G.addedPlayers,{__call = fucntion(self,arg) for _,n in pairs(self) do if n == arg then return true end end return false end})
--Put that at the top and then you can do:
if _G.addedPlayers(PLAYER_HERE) then --Stuff end
|
|
|
| Report Abuse |
|
|
Frostftw
|
  |
| Joined: 15 Nov 2010 |
| Total Posts: 73 |
|
|
| 19 Nov 2013 07:42 PM |
How about, if player and (_G.addedPlayers(player)) then |
|
|
| Report Abuse |
|
|
Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
| |
|
|
| 19 Nov 2013 07:57 PM |
| What about what I posted......It should work. |
|
|
| Report Abuse |
|
|
Cizox
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 42220 |
|
|
| 19 Nov 2013 08:01 PM |
| It appears there is an error with the "{". I tried fixing it but the error doesn't disappear. |
|
|
| Report Abuse |
|
|
|
| 19 Nov 2013 08:09 PM |
I just spelt function wrong
setmetatable(_G.addedPlayers,{__call = function(self,arg) for _,n in pairs(self) do if n == arg then return true end end return false end}) |
|
|
| Report Abuse |
|
|