|
| 01 May 2015 03:02 PM |
plr = script.Parent.Parent.Parent.Parent.Parent price = 0 script.Parent.MouseButton1Click:connect(function() local v = plr.leaderstats.Money if v.Money.Value <= price then game.Lighting.Narsil:clone().Parent = plr.Backpack v.Money.Value = v.Money.Value - price end end)
--I made it 0 so I could test it, the currency is Money this is the leaderstat script game.Players.PlayerAdded:connect(function(Player) stats = Instance.new("IntValue", Player) stats.Name = "leaderstats"
money = Instance.new("IntValue", stats) money.Name = "Money"
end) -- the tool is called "Narsil" |
|
|
| Report Abuse |
|
|
|
| 01 May 2015 03:06 PM |
| I want to press the button and it will add the sword |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 May 2015 03:08 PM |
Add something like this:
local sword = sword:clone() sword.Parent = game.Players.LocalPlayer.StartGear
|
|
|
| Report Abuse |
|
|
|
| 01 May 2015 03:11 PM |
at the end? i really am not good at lua.
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 May 2015 03:15 PM |
| No at the part where you buy the sword. |
|
|
| Report Abuse |
|
|
|
| 01 May 2015 03:17 PM |
after this, ty for all ur help btw i didnt know people here actually cared about newbags like me if v.Money.Value <= price then
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 May 2015 03:18 PM |
| Yes, and also make sure you change sword to what your sword's name is. |
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 May 2015 03:19 PM |
Or item. Idk why I said "sword." :P |
|
|
| Report Abuse |
|
|
|
| 01 May 2015 03:20 PM |
doesn't work, It comes up with Money is not a valid member of IntValue when I put it in as it e.e
|
|
|
| Report Abuse |
|
|
Klink45
|
  |
| Joined: 06 Jun 2011 |
| Total Posts: 26054 |
|
|
| 01 May 2015 03:23 PM |
Here, try this:
local plr = script.Parent.Parent.Parent.Parent.Parent local price = 0 script.Parent.MouseButton1Click:connect(function() local v = plr.leaderstats.Money if v.Money.Value <= price then local Item = game.Lighting.Narsil:Clone() Item.Parent = game.Players.LocalPlayer.StarterGear --Keeps the tool after respawning. local Item = game.Lighting.Narsil:Clone() --Probably not the best way to do this. Item.Parent = game.Players.LocalPlayer.StarterPack end end)
--I made it 0 so I could test it, the currency is Money this is the leaderstat script game.Players.PlayerAdded:connect(function(Player) stats = Instance.new("IntValue", Player) stats.Name = "leaderstats"
money = Instance.new("IntValue", stats) money.Name = "Money"
end) -- the tool is called "Narsil" |
|
|
| Report Abuse |
|
|
|
| 01 May 2015 03:33 PM |
doesn't work e.e I'm probably doing it wrong though, sorry for bothering you, just trying to learn LUA |
|
|
| Report Abuse |
|
|