#attempt to perform arithmetic (sub) on instance and number

7 messages · Page 1 of 1 (latest)

vague grove
#

When I try to decrease the number of a NumberValue it tells me "attempt to perform arithmetic (sub) on instance and number" and I don't know why, according to me everything is correct, I leave the script to see if you can help me because I have already looked for a solution to the problem and it doesn't work or I don't understand, thanks.

#

local Temperature = script.Parent
local LaserV = script.Parent.Laser
local CoolantV = script.Parent.Coolant

-- Check Coolant --
if CoolantV == true then
script.Enabled = false
end

-- Check Laser --
if LaserV == true then
script.Enabled = false

end

local debugT = 3
local T = 30
while true do
wait(debugT)
Temperature = Temperature - 4000
end

simple mauve
#

Temperature.Value = Temperature.Value - 4000

#

you want to change the property, but you are using the variable which is the object itself

#

hope that helps!

wet summit
#

Just to add to that a easier way to do it is by doing Temperature.Value -= 4000