|
| 05 Jun 2013 10:03 AM |
I.e. x = game.Players.whateveritishere for loop here |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:05 AM |
| http://wiki.roblox.com/index.php/GetPlayerFromCharacter |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:06 AM |
Wait so it works both ways, in that if I do
player = game.Players:GetPlayerFromCharacter(character)
"character" is the players character? |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 05 Jun 2013 10:07 AM |
| local Character = game.Players.PlayerHere.Character |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:08 AM |
Yes local character = Workspace.Jammintoad |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:09 AM |
So, would this work.
theguis = game.Players:GetPlayerFromCharacter(character) for i = 1, #theguis do if theguis[i].character.PlayerGui.Map1 ~= nil then theguis[i].character.PlayerGui.Map1.TeleportButton.Text = "Destroying..." end end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:10 AM |
Sorry, from reading your post I was thinking you wanted to get the player from character
local = game.Players:GetChildren() for i = 1, #p do char = Workspace:FindFirstChild(p[i]) print(char.Name) end |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:11 AM |
^ local p = game.Players:GetChildren() |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:12 AM |
| What if the player died, then wouldn't the Player's character not exist in workspace and break the script? |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:12 AM |
char = Workspace:FindFirstChild(p[i].Name)
Sorry :( |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:13 AM |
| The character still exists in workspace when they die, but not when respawning |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:15 AM |
| Right, so what if it runs while they respawn. ._. |
|
|
| Report Abuse |
|
|
|
| 05 Jun 2013 10:21 AM |
Ugh I'm pathetic. Where do I find the GUIs that are currently in a character? Ex: char = Workspace:FindFirstChild(p[i].Name) if char.PlayerGui.Map1 ~= nil then char.PlayerGui.Map1.TeleportButton.Text = "Destroying... |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 05 Jun 2013 10:25 AM |
local players = game.Players:GetChildren() for _,v in pairs(Players) do --_ being the index, v being the object character = v.Character --Player is a propery of character guiHolder = v.PlayerGui --PlayerGui is also a child of player, not character if guiHolder:findFirstChild("Map1") then --If it doesn't equal nil guiHolder.Map1.TeleportButton.Text = "Destroying... end end |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Jun 2013 10:53 AM |
Player.Character
Character contains you actual character. The one in workspace. Not visible but works ;)
swagmiester |
|
|
| Report Abuse |
|
|