2DWorlds Forums
What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Printable Version

+- 2DWorlds Forums (http://2dworlds.buildism.net/forum)
+-- Forum: 2DWorlds (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=4)
+--- Forum: Scripting (http://2dworlds.buildism.net/forum/forumdisplay.php?fid=13)
+--- Thread: What is the buildism equivalent of game.Players:getPlayerFromCharacter() (/showthread.php?tid=7755)



What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Duck - 08-07-2011

I can't find it on the wiki, and it doesn't seem to be the same as on roblox


RE: What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Qwertygiy - 08-07-2011

You have to do it the hard way.

[lua]
--SCHTUPH
local character = script.Parent --(or hit.Parent or whatever)
local player = game.Players:getChild(character.Name)
if player then
--MOARE SCHTUPH
end
--EEVIN MOARE SCHTUPH
[/lua]


RE: What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Duck - 08-07-2011

Derp

I probably should have figured out I could do it that way.

I think I'm too used to roblox spoonfeeding me D:


RE: What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Qwertygiy - 08-07-2011

If you can code it the regular way, using simpler terms, you can often get more done than if you have to rely on the 'longcuts' that often pop up.

I've found that quite often, all I need to use in a script right now are properties, variables, for loops, while loops, os.time(), sleep(), getChildren(), getChild(), and link(event, function).


RE: What is the buildism equivalent of game.Players:getPlayerFromCharacter() - Jacob__mybb_import1 - 08-07-2011

If you're sure the player is there, you can do it the quick way: (this will break the script if it can't find the player)

[lua]
player = game.Players[character.Name]
[/lua]