Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

2 comments

0

the condition for repeat loops shouldn't be a string

0

the contents of a repeat loop should be between the repeat and until

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.