|
| 21 Mar 2012 11:28 AM |
How would I make this script only function for specified names only?
game.Players.PlayerAdded:connect(function(pl) pl.CharacterAdded:connect(function(char) repeat wait() until char:FindFirstChild('Humanoid') local hum = char.Humanoid hum.Changed:connect(function(p) if p == 'Health' then print(pl.Name..'\'s health is: '..pl.Health) end end) end) end) |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2012 02:53 PM |
| I am thinking of adding a table but I'm not very good with tables and I want to get help for it. |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Mar 2012 01:10 AM |
| You havent' defined pl in line 2. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2012 01:23 AM |
Really? It still works, I've tested it, I just want to figure out a way for only certain players to see the different players health changed. Would this work?
allowed = {["TheSoMekTime"] = true game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) if allowed[player.Name] then game.Players.PlayerAdded:connect(function(pl) pl.CharacterAdded:connect(function(char) repeat wait() until char:FindFirstChild('Humanoid') local hum = char.Humanoid hum.Changed:connect(function(p) if p == 'Health' then print(pl.Name..'\'s health is: '..pl.Health) end end) end) end)
|
|
|
| Report Abuse |
|
|
iHeal
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 6 |
|
|
| 23 Mar 2012 10:01 AM |
| Try the IfNotAllowedIn function, also don't be afraid to study Person299's admin script. Its how I learned that function and it is very useful. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2012 10:08 AM |
Allowed = { "dog", "DragonFang1" }--just as an example so you know how to add more names
game.Players.PlayerAdded:connect(function(pl) pl.CharacterAdded:connect(function(char) for _,v in ipairs(Allowed) do if pl.Name==v then repeat wait() until char:FindFirstChild('Humanoid') local hum = char.Humanoid hum.Changed:connect(function(p) if p == 'Health' then print(pl.Name..'\'s health is: '..pl.Health) end end end end) end) end) |
|
|
| Report Abuse |
|
|