|
| 13 Feb 2016 02:06 PM |
Okay so have a script that creates a folder for the players stat's inside the player here's the script if you dont know what I mean
game.Players.PlayerAdded:connect(function(plr) local Folder = Instance.new("Folder",plr) Folder.Name = "Stats" local Cash = Instance.new("IntValue",Folder) Cash.Name = "Cash" Cash.Value = 25 local VIP = Instance.new("BoolValue",Folder) VIP.Name = "VIP"
end)
but I am trying to this this properly so basicly when the cash value changes I want the value to update as well. I have this script below in a local script inside the player gui but it does not work suggestions?
game.Players.Player.Stats.Cash.Value.Changed:connect(function() script.Parent.Parent.Players.Player.PlayerGui.ScreenGui.Cash.Button.Text = script.Parent.Parent.Players.Player.Stats.Cash.Value end)
|
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:09 PM |
game.Players.Player.Stats.Cash.Value.Changed:connect(function() script.Parent.Parent.Players.Player.PlayerGui.ScreenGui.Cash.Button.Text = script.Parent.Parent.Players.Player.Stats.Cash.Value end) should be
game.Players.LocalPlayer.Stats.Cash.Value.Changed:connect(function() game.Players.LocalPlayer.PlayerGui.ScreenGui.Cash.Button.Text = game.Players.LocalPlayer.Stats.Cash.Value end) |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:12 PM |
I got an error
12:11:42.775 - Players.Player.PlayerGui.LocalScript:2: attempt to index field 'Value' (a number value) |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:14 PM |
| Well, what is this "Stats" thing anyway? |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:16 PM |
| It's a folder inside the player It's for me to keep track of important thing's such as value's and it would make it 100X times easier for data saving. |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:18 PM |
My mistake, here's the working version -- I hope.
game.Players.LocalPlayer.Stats.Cash.Changed:connect(function() game.Players.LocalPlayer.PlayerGui.ScreenGui.Cash.Button.Text = game.Players.LocalPlayer.Stats.Cash.Value end) |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:20 PM |
| Thank you sir, I just seem to have a hard time getting values out side of a service it's just weird for me lol have a nice day ty. |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:42 PM |
You're welcome. Here's a tip. If you're setting a value into a variable, it won't update or detect a change unless updated.
Such as:
game.Players.LocalPlayer.Charcter.Humanoid.Health.Changed -- won't work, because health is a value.
game.Player.LocalPlayer.Character.Humanoid.Changed:connect(function() if game.Player.LocalPlayer.Character.Humanoid.Health < = 90 then -- blah end end)
That would work. |
|
|
| Report Abuse |
|
|
|
| 13 Feb 2016 02:43 PM |
http://wiki.roblox.com/index.php?title=Variable
|
|
|
| Report Abuse |
|
|