0x688
|
  |
| Joined: 06 Mar 2010 |
| Total Posts: 373 |
|
|
| 19 Sep 2014 10:01 AM |
Hello I have this shop script which is in a shop gui
player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent money = player.leaderstats.Money price = 500 tool = game.Lighting:findFirstChild("Adipem")
function buy() if money.Value >= price then money.Value = money.Value local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear
end end script.Parent.MouseButton1Down:connect(buy)
its giving me an error saying that leaderstats is not a valid member of player...
what should i do? |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2014 10:07 AM |
Maybe your script is running before leaderstats has loaded.
Try doing
money = player:WaitForChild'leaderstats':WaitForChild'Money'
Then if your script doesn't work after that there are 3 things: 1. You tagged Player incorrectly. 2. leaderstats is never being created and parented. 3. Money is never being created and parented. |
|
|
| Report Abuse |
|
|
|
| 19 Sep 2014 10:11 AM |
player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent money = player.leaderstats.Money price = 500 tool = game.Lighting:findFirstChild("Adipem")
function buy() while money.Value and price do money.Value = money.Value local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear end end script.Parent.MouseButton1Down:connect(buy) |
|
|
| Report Abuse |
|
|
0x688
|
  |
| Joined: 06 Mar 2010 |
| Total Posts: 373 |
|
|
| 19 Sep 2014 10:19 AM |
i tried first solution and it worked... thanks both for responding and thanks for the good solution :)) |
|
|
| Report Abuse |
|
|