gansest
|
  |
| Joined: 08 Apr 2010 |
| Total Posts: 609 |
|
|
| 04 Jun 2013 01:13 AM |
Hey, I am trying to make a script, where Values are the most important objects. I do so: Player steps on a brick, he gets a value in his Humanoid.Parent **If a player has a value of 1, the next player touched gets a value of 2.** But no idea how to find the next player and not change others' value.
Is there something easy to solve this trouble? |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2013 02:03 AM |
e = Instance.new("IntValue") e.Value = 0 e.Parent = script.Parent
script.Parent.Touched:connect(function(h) if h.Parent.Humanoid then local m = Instance.new("IntValue",h.Parent) m.Name = "Namehereplawx" m.Value = e.Value + 1 end e.Value = e.Value + 1 end)
--Maybe? |
|
|
| Report Abuse |
|
|
|
| 04 Jun 2013 02:06 AM |
Wait. I should add a Debounce to that.
e = Instance.new("IntValue") e.Value = 0 e.Parent = script.Parent
debounce = false
script.Parent.Touched:connect(function(h) if h.Parent.Humanoid and debounce == false then debounce = true local m = Instance.new("IntValue",h.Parent) m.Name = "Namehereplawx" --Name here m.Value = e.Value + 1 end debounce = false e.Value = e.Value + 1 end) |
|
|
| Report Abuse |
|
|
gansest
|
  |
| Joined: 08 Apr 2010 |
| Total Posts: 609 |
|
|
| 04 Jun 2013 05:35 AM |
| Thanks about that, I'll try it as soon as I can |
|
|
| Report Abuse |
|
|
getkoed2
|
  |
| Joined: 11 Apr 2010 |
| Total Posts: 1144 |
|
|
| 04 Jun 2013 09:22 AM |
local currentvalue = 0
script.Parent.Touched:connect(function(hit) if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then local v = Instance.new("NumberValue", hit.Parent) v.Value = currentvalue + 1 currentvalue = v.Value end end) |
|
|
| Report Abuse |
|
|