|
| 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
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 7685 |
|
| |
|
|
| 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
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 496 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|