Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

I am getting a big error about my "TempIncrease" script. Can anybody help me?

Asked by 5 years ago

So I am building a nuclear reactor core and for my script called "TempIncrease", I am getting this error listed below: Workspace.TempIncrease:4: attempt to index local 'Temp' (a number value)

This is my script:

game.Workspace.Temp.Value = 0

repeat until "game.Workspace.Temp.Value = 2000"

local Temp = game.Workspace.Temp.Value

Temp.Value = Temp.Value + 7

wait(6.5)

Is there any way to help?

If there is thank you.

0
the condition for repeat loops shouldn't be a string theking48989987 2147 — 5y
0
the contents of a repeat loop should be between the repeat and until theking48989987 2147 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Several problems: The format of a repeat until loop is repeat {the code to repeat} until {condition}. The condition is not a string (text inside quotation marks), it is an expression, like sky.color == blue. You used the assignment operator in your conditional (=) instead of the equality operator (==). You got the Value of Temp in a variable, and then tried to get the Value property of that. Fixed code:

local Temp = workspace:WaitForChild('Temp')
  Temp.Value = 0
  repeat
      Temp.Value = Temp.Value + 7
      wait(6.5)
  until Temp.Value == 2000
  
Ad

Answer this question