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
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: ShopGui

Previous Thread :: Next Thread 
flamehead505 is not online. flamehead505
Joined: 31 Oct 2009
Total Posts: 15
05 Jul 2013 10:41 AM
I need help with this....

function Click()
player = script.Parent.Parent.Parent.Parent.Parent.Parent
stats = player.leaderstats
cash = stats.Cash
local grav = game.Lighting:findFirstChild("GravityCoil")
if cash.Value > 999 then
cash.Value = cash.Value - 1000
grav:clone().Parent = player.BackPack
end
end

script.Parent.MouseButton1Down:connect(Click)

Any thoughts?



this is my first post.....
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
05 Jul 2013 10:41 AM
Output?
Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
05 Jul 2013 10:43 AM
I recommend using a LocalScript to keep it neater and to ensure a better run. Also, you can do >= 1000 instead. Plus, this only clones the coil to the backpack, meaning when the player dies he/she loses it.
Report Abuse
chichine is online. chichine
Joined: 16 Jul 2011
Total Posts: 496
05 Jul 2013 10:44 AM
I agree :P
Report Abuse
flamehead505 is not online. flamehead505
Joined: 31 Oct 2009
Total Posts: 15
06 Jul 2013 09:43 AM
I had that before but I just wanted to make sure this worked :p

but I will try your info
Report Abuse
spearman2 is not online. spearman2
Joined: 28 May 2010
Total Posts: 2938
06 Jul 2013 10:01 AM
I need help with this....

function Click()
player = game.Players.LocalPlayer
local stats = player:FindFirstChild("leaderstats")
if stats then --failsafe
local cash = stats:FindFirstChild("Cash")
local grav = game.Lighting:findFirstChild("GravityCoil")
if cash.Value > 1000 then --let's make it 1000 just in case
cash.Value = cash.Value - 1000
local tool = grav:Clone()
tool.Parent = player.Backpack
else --Just in case they don't have enough money..
print(player.Name.." does not have enough")
end
end
end

script.Parent.MouseButton1Click:connect(Click)

--MouseButton1Down is for tools I believe, MouseButton1Click is for GUIs 
Report Abuse
spearman2 is not online. spearman2
Joined: 28 May 2010
Total Posts: 2938
06 Jul 2013 10:03 AM
print("Put this code in a localscript")

function Click()
player = game.Players.LocalPlayer
local stats = player:FindFirstChild("leaderstats")
if stats then --failsafe
local cash = stats:FindFirstChild("Cash")
local grav = game.Lighting:findFirstChild("GravityCoil")
if cash.Value > 1000 then --let's make it 1000 just in case
cash.Value = cash.Value - 1000
local tool = grav:Clone()
tool.Parent = player.Backpack
else --Just in case they don't have enough money..
print(player.Name.." does not have enough")
end
end
end

script.Parent.MouseButton1Click:connect(Click)

--MouseButton1Down is for tools I believe, MouseButton1Click is for GUIs 
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