RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
|
| 13 May 2016 09:19 PM |
okay so i have a number value, and whenever i try to add 1 to its value, it instead adds a number incremented by one each time i add it, example...
what i want: 1+1 = 2 2+1 = 3 3+4 = 4
whats happening 1+1 = 2 2+2 = 3 3+3 = 6 6+4 = 10 7+5 = 13 etc..
heres what i have prog.Value = prog.Value+1
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
| |
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
|
| 13 May 2016 09:23 PM |
I don't see how that would help since its literally that one line that's not working, but since you asked, here's some of the stuff around it
local v = Instance.new("NumberValue") v.Parent = script v.Name = "Progress" v.Value = 0 elseif placed == true then mouse.Button1Up:connect(function() local prog = script:FindFirstChild("Progress") if prog.Value<60 then prog.Value = prog.Value+1 move(0.056,hole)
|
|
|
| Report Abuse |
|
|
Wowgnomes
|
  |
| Joined: 27 Sep 2009 |
| Total Posts: 26255 |
|
|
| 13 May 2016 09:24 PM |
if prog.Value<60 then wait() prog.Value = prog.Value+1 try it and post output up to 10
|
|
|
| Report Abuse |
|
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
|
| 13 May 2016 09:29 PM |
Well that's odd
when i click it doesn't add the inremented value, it actually runs it that many times so the first time i click it runs once, then the second time it runs twice, third it runs three times, etc.
Still don't know why that's happening
|
|
|
| Report Abuse |
|
|
|
| 13 May 2016 09:30 PM |
| Is the event in a function or something that is probably in the Changed event? |
|
|
| Report Abuse |
|
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
|
| 13 May 2016 09:31 PM |
I don't think so, it only runs when the player clicks
|
|
|
| Report Abuse |
|
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
|
| 13 May 2016 09:32 PM |
Heres the whole function:
mouse.Button1Up:connect(function() if placed == false then placed = true move(-2.8,hole) tran(hole,0) script.Parent.Parent.Parent.Parent.Msg.Visible = true script.Parent.Parent.Parent.Parent.Msg.TextLabel.Text = "Click More to Dig" local v = Instance.new("NumberValue") v.Parent = script v.Name = "Progress" v.Value = 0 elseif placed == true then mouse.Button1Up:connect(function() local prog = script:FindFirstChild("Progress") if prog.Value<60 then wait() prog.Value = prog.Value+1 print(prog.Value) move(0.056,hole) elseif prog.Value == 60 then finished = true script.Parent.Parent.Parent.Parent.Msg.Visible = false script.Parent.Parent.Parent.Parent.Msg.TextLabel.Text = "Click to Place" game.Players.LocalPlayer.Character:FindFirstChild("Knapsack").Parent = game.Players.LocalPlayer.Backpack end end) end end)
|
|
|
| Report Abuse |
|
|
|
| 13 May 2016 09:32 PM |
| Well there's your problem, you're creating a ton of events |
|
|
| Report Abuse |
|
|
RPG_Dev
|
  |
| Joined: 19 Nov 2011 |
| Total Posts: 419 |
|
| |
|