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.
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