![]() |
Player.ChildAdded script, to add stats not working - 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: Player.ChildAdded script, to add stats not working (/showthread.php?tid=9985) |
Player.ChildAdded script, to add stats not working - technoguyx - 09-04-2012 I'm trying to add two IntegerValues to the (only - SP game) player's Stats object, but it doesn't seem to work unless I run the script manually with the right-click menu. I've Enabled it, and tried it under World and Players, yet nothing happens. It yields no errors. I'd appreciate it if someone could check this and tell me if anything's wrong. Code: link(game.Players.ChildAdded, function(p) RE: Player.ChildAdded script, to add stats not working - Qwertygiy - 09-04-2012 The thing is, scripts don't run once you finish editing them, or when you select "Enabled". The latter is a bit annoying and should be changed in my opinion. To get it to work, you have to right-click it and select "Run" or create a new instance of the script, either by saving and reloading/publishing and playing the game or cutting and pasting the script object. RE: Player.ChildAdded script, to add stats not working - technoguyx - 09-05-2012 (09-04-2012, 02:27 PM)Qwertygiy Wrote: The thing is, scripts don't run once you finish editing them, or when you select "Enabled". The latter is a bit annoying and should be changed in my opinion. To get it to work, you have to right-click it and select "Run" or create a new instance of the script, either by saving and reloading/publishing and playing the game or cutting and pasting the script object.So, it should work if I load the place again. I've tried that before posting this, but nothing happened. :/ Gotta check again now. RE: Player.ChildAdded script, to add stats not working - Jacob__mybb_import1 - 09-05-2012 Just to make sure, are you adding the player after running the script? And when you load a game in the editor, scripts won't run until you click the play button. RE: Player.ChildAdded script, to add stats not working - technoguyx - 09-11-2012 (09-05-2012, 11:32 PM)Jacob_ Wrote: Just to make sure, are you adding the player after running the script?This was exactly the problem - I was used to adding the player before starting the physics. ![]() |