generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: shop problem

Previous Thread :: Next Thread 
0x688 is not online. 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
DrunkerScripter is not online. DrunkerScripter
Joined: 22 Jun 2013
Total Posts: 275
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
BothAngles is not online. BothAngles
Joined: 01 Dec 2011
Total Posts: 9604
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image