Basically, if someone is in a table (called hosts), I want to do something... is it related to this?
for i,v in pairs(hosts) do end
How would I do it?
If you can't understand, then...
for i,v in pairs(hosts) do if (player is in a table called hosts) then end end
OBVIOUSLY , if player is in a table called hosts then isn't correct, but I need help with it. I hope you guys understand D;.
UPDATE: I may've worked it out, but I don't think so. Is this correct:
for i,v in pairs(hosts) do if player.Name == v then end end
I'm assuming that you want to check if a player is in the table called hosts and to check that it would be simple:
local hosts = {"imaginaryjeffery321"} for i,v in pairs(hosts) do for i2,p in pairs(game.Players:GetPlayers()) do --This will loop through all the player's currently in the game if p.Name == v then --p.Name because the value in hosts is a string value and not a player object. --Whatever stuff you want, host priveleges presumably. break end end end
However, if you want to check if a player is in that table when they join. That'll be like so:
local hosts = {"imaginaryjeffery321"} game.Players.PlayerAdded:connect(function(ply) --This is called whenever a player is added. for i,v in pairs(hosts) do if ply.Name == v then --p.Name because the value in hosts is a string value and not a player object. --Host stuff break end end end)
Hope this is what you were looking for.