generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Getting someone from a table

Previous Thread :: Next Thread 
Cizox is not online. 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
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
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 is not online. 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 is not online. Cizox
Joined: 25 Dec 2009
Total Posts: 42220
19 Nov 2013 07:47 PM
@Frost

Doesn't work.
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
19 Nov 2013 07:57 PM
What about what I posted......It should work.
Report Abuse
Cizox is not online. 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
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image