|
| 16 Feb 2014 07:37 AM |
ok want it to subtract money(lederboard stats) from this
price = script.Parent.Parent.Price.Value local debounce = true function onTouched(part) local h = part.Parent:FindFirstChild("Humanoid") if game.Players[h.Parent.Name].Value.Value < price then return end if debounce == true then debounce = false game.Players[h.Parent.Name].Value.Value = game.Players[h.Parent.Name].Value.Value - price a = game.Lighting[script.Parent.Parent.Product.Value]:Clone() a.Parent = game.Players[h.Parent.Name].Backpack wait(4) debounce = true end end script.Parent.Touched:connect(onTouched)
actually can someone help me? the item is in lighting but it wont spawn in backpack |
|
|
| Report Abuse |
|
|
| |
|
shawnyg
|
  |
| Joined: 21 Apr 2011 |
| Total Posts: 1428 |
|
|
| 16 Feb 2014 07:43 AM |
price = script.Parent.Parent.Price.Value local debounce = true script.Parent.Touched:connect(function(part) local h = part.Parent:FindFirstChild("Humanoid") if h then plr = game.Players:GetPlayerFromCharacter(part.Parent) if debounce == true then debounce = false if (plr.leaderstats.LeaderStatNameHere.Value >= price) then plr.leaderstats.LeaderStatNameHere.Value = plr.leaderstats.LeaderStatNameHere.Value - price a = game.Lighting[script.Parent.Parent.Product.Value]:Clone() a.Parent = plr.Backpack wait(4) debounce = true end end end end)
~The G |
|
|
| Report Abuse |
|
|
| |
|
shawnyg
|
  |
| Joined: 21 Apr 2011 |
| Total Posts: 1428 |
|
|
| 16 Feb 2014 07:49 AM |
No problem. Instead of trying to find the child in players, you should use the GetPlayerFromCharacter method.
~The G |
|
|
| Report Abuse |
|
|