generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: wtf math

Previous Thread :: Next Thread 
RPG_Dev is not online. 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 is online. Wowgnomes
Joined: 27 Sep 2009
Total Posts: 26255
13 May 2016 09:20 PM
can u post actual script


Report Abuse
RPG_Dev is not online. 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 is online. 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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
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 is not online. 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 is not online. 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
Flux_Capacitor is not online. Flux_Capacitor
Joined: 07 Apr 2008
Total Posts: 45720
13 May 2016 09:32 PM
Well there's your problem, you're creating a ton of events
Report Abuse
RPG_Dev is not online. RPG_Dev
Joined: 19 Nov 2011
Total Posts: 419
13 May 2016 09:36 PM
So how can I fix that?


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image