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 » Scripting Helpers
Home Search
 

Re: This isn't working... No output

Previous Thread :: Next Thread 
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:13 AM
while true do
wait(5)
local Value1 = script.Parent
local CT = script.Parent.Parent.CT
CT.Value = CT.Value -Value1.Value
end
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
05 Apr 2014 12:16 AM
local Value1 = script.Parent
local CT = script.Parent.Parent.CT

while true do
wait(5)
CT.Value = CT.Value -Value1.Value
end

I think it was because you were defining the variables inside the loop.

Also, if it's a local script, add a wait(1) at the top. Like this:

wait(1)

local Value1 = script.Parent
local CT = script.Parent.Parent.CT

while true do
wait(5)
CT.Value = CT.Value -Value1.Value
end
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:19 AM
It still doesn't work D:
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
05 Apr 2014 12:20 AM
What exactly are you trying to do?
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:20 AM
So if the value of Value1 is 5, then every 5 second it will subtract 5 from the value of CT. Understand that? Its hard to explain
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:28 AM
Anyone?
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
05 Apr 2014 12:31 AM
um local variable with parent?
lolno
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
05 Apr 2014 12:32 AM
while true do
wait(5)
Value1 = script.Parent
CT = script.Parent.Parent.CT
CT.Value = CT.Value -Value1.Value
end
-- local vars accessed from anywhere, can't use parents of script.
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:35 AM
Lets say the value of Value1 is 15, and the value of CT is 400. Every 5 second, it should do 400 - 15. Now lets say the Value of 1 changes to 10, now, every 5 second it should do 400 - 10. Thats why a script like this:

while true do
wait(5)
local Value1 = script.Parent
local CT = script.Parent.Parent.CT
CT.Value = CT.Value -10
end

wouldn't work. Because it would continuously do 10, not the value of value1...

Does that explain it better?
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
05 Apr 2014 12:36 AM
Did you try what I said?
Additionally, going further in depth about the values is appreciated.
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:37 AM
First of all, I don't see a change. Second, no it doesn't work. Should I run it in a local script?
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:41 AM
Should I run it in a local script? *Cough wow Cough*
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
05 Apr 2014 12:42 AM
Hold on, are these StringValues or IntValues? To apply math operations, it must be an IntValue.
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:43 AM
Its IntValue
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
05 Apr 2014 12:43 AM
Can you please stop posting on other scripts asking why we won't help you but we'll help them? I really don't know what's wrong with your script, but I'm sure someone will find out without you spamming. :\
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:44 AM
Wait! I put IntValue, but it says their string! Let me fix that...
Report Abuse
KOTwarrior is not online. KOTwarrior
Joined: 13 Jun 2012
Total Posts: 4376
05 Apr 2014 12:45 AM
The change I made is strictly within grammatical references of scripting. You improperly used a local variable there. If Value1's value is not changing, why not increment it in a forloop rather then doing this?
Report Abuse
usfirepilot is not online. usfirepilot
Joined: 17 Jan 2013
Total Posts: 684
05 Apr 2014 12:45 AM
I'm so sorry! This was all my fault! I forgot to change the value of #1 to 5 so it started subtracting, and I needed int values. I am so sorry D:
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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