|
| 27 Oct 2012 11:27 AM |
Can anyone tell me how to add to a value in a player's backpack by stepping on a brick? I tried using the "GetPlayerFromCharacter()" function but I didn't manage to get it to work. Can anyone help me?
script.Parent.Touched:connect(function() --??? n.Value = (n.Value + 1) |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2012 11:31 AM |
script.Parent.Touched:connect(function(playerpart) if playerpart.Parent.ClassName == "Model" then a = game.Players:GetPlayerFromCharacter(playerpart.Parent) Instance.new("NumberValue", a.Backpack) end end)
Change NumberValue to whatever value you want to put in.
Tactical Rainboom Inbound |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2012 11:32 AM |
Oh, if you want to add to a value that's already in the backpack, replace Instance.new("NumberValue", a.Backpack) with a.Backpack.NumberValue.Value = a.Backpack.NumberValue.Value - 1
Tactical Rainboom Inbound |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2012 11:33 AM |
I MEAN + 1. STUPID BRAIN. I look like a spammer now, lol.
Making sure floodcheck won't stop me... Floodcheck stop complete.
Tactical Rainboom Inbound |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2012 11:36 AM |
| Thank you, this is really useful and it works. |
|
|
| Report Abuse |
|
|
|
| 27 Oct 2012 11:38 AM |
You're welcome.
Tactical Rainboom Inbound |
|
|
| Report Abuse |
|
|
Joalmo
|
  |
| Joined: 28 Jun 2009 |
| Total Posts: 1160 |
|
|
| 27 Oct 2012 11:46 AM |
| You might want to add a debounce |
|
|
| Report Abuse |
|
|