liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 09:29 AM |
Two scripts.
Script 1:
game.Players.PlayerAdded:connect(function(player) print ("Player joined the game!") player:WaitForDataReady() c = player:LoadNumber("Money") b = player:LoadBoolean("Played") if c.Value == 0 and b.Value == false then print ("Player needs a new money value!") player.CharacterAdded:connect(function(character) a = Instance.new("NumberValue") a.Parent = character a.Name = ("Money") a.Value = 100 a:SaveNumber("Money") a:SaveBoolean("Played", true) print("New money value was created!") end) end end)
Script 2:
gui = script.Parent game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) player:WaitForDataReady() cash = character.Money.Value cash:Changed(Value) gui.Text = (cash.."$") end) end)
They both don't have a output and don't work in online or solo. Help? |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 20 Jul 2012 09:33 AM |
| I don't believe you've put script 2 in the workspace. Scripts that aren't in the workspace or Players won't work. (As far as I know) |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 10:08 AM |
| script 2 is inside of a gui. |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2012 10:22 AM |
| is te gui in the wrokspace? |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 20 Jul 2012 10:23 AM |
| Then it sure won't work. If a Player enters, the Player loads first, and then the tools and Gui's are placed inside of it. If you make a "PlayerAdded" script, and put it in the Gui, it will only trigger when someone else joins the game, because once the Gui is put inside of the Player, the player has already entered. |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 10:25 AM |
| So do I need to add a wait() or something? |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 20 Jul 2012 10:28 AM |
| No, you need to put it in the workspace. |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 10:38 AM |
game.Players.PlayerAdded:connect(function(player) wait(0.5) player.CharacterAdded:connect(function(character) gui = player.PlayerGui.Money.Frame.TextLabel player:WaitForDataReady() cash = character.Money.Value cash:Changed(Value) gui.Text = (cash.."$") end) end)
Thats the new script. It still doesn't work. Do remember that script 2 will not work unless script 1 works. |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 20 Jul 2012 10:44 AM |
cash = character.Money.Value cash:Changed(Value)
Changed is an event from a Value. Not from a Value's Value. So it's supposed to be:
cash = character.Money.Value character.Money:Changed(Value) |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 10:50 AM |
Still doesn't work.
And a question:
Does changed work only once? Or does it activate EVERY time the value changes? If so, that can't work. |
|
|
| Report Abuse |
|
|
Zomebody
|
  |
| Joined: 01 Jun 2010 |
| Total Posts: 789 |
|
|
| 20 Jul 2012 10:54 AM |
| I've never used it, but I think it's supposed to be for multiple uses. Right now I'm quite busy so I probably won't react anymore for some time. |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 10:55 AM |
| If for multiple uses, then it should be okay. Loops will just be plain laggy. |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
| |
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 01:11 PM |
| This is still broken. Just saying. |
|
|
| Report Abuse |
|
|
|
| 20 Jul 2012 02:20 PM |
First of all, SaveNumber has two arguments.
a:SaveNumber("Money", 0)
Second, Changed is an event, and it runs in an object, not a property.
gui = script.Parent game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) player:WaitForDataReady() cash = character.Money cash.Changed:connect(function(Value) gui.Text = (cash.Value.."$") end) end) |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
| |
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 20 Jul 2012 02:52 PM |
| Can't post the output though... |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 20 Jul 2012 02:55 PM |
game.Players.PlayerAdded:connect(function(player) wait(0.5) player.CharacterAdded:connect(function(character) gui = player.PlayerGui.Money.Frame.TextLabel player:WaitForDataReady() cash = character.Money.Value cash:Changed(Value) gui.Text = (cash.."$") end) end)
idk how... but make something like: cash:connect(changed) like that |
|
|
| Report Abuse |
|
|
liavt
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 1241 |
|
|
| 21 Jul 2012 08:50 AM |
Still not working...
I believe its something with script 1. |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|