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

recolor script won't work, help please?

it wont recolor the CompLights after the value became true (that happend with another script and I tested it, that worked perfect) can someone help me?

System = game.Workspace.System
AlertV = System.AlertV

if AlertV.Value == true then
	for i, v in pairs(game.Workspace:GetChildren()) do 
		if v.Name == 'CompLight' then
		v.BrickColor = BrickColor.new('Really red')
	end
end

while true do
	Current = game.Workspace.System.Temperature
	CurrentV = game.Workspace.System.Temperature.Value
	SysON = game.Workspace.System.SysON
	function NewText()
	game.Workspace.MasterScreen.MasterScreen.Gui.Frame.Temp.Text = ""..CurrentV.." C"
	end
	NewText()

	if SysON.Value == true then
	wait(5)
	Current.Value = Current.Value  + 2
	end
	NewText()

	if Current.Value == 1200 then
	game.Workspace.System.AlertV.Value = true
	end
	
end	

1 answer

✓ Accepted answer

Is this the whole script? The script doesn't loop or contain a function or anything, so when it is inserted into the Workspace (or wherever it's supposed to go to) it will only run once. To fix this, you can try creating a loop that checks whether or not AlertV.Value == true. Also, it appears you're missing an end in the script.

System = game.Workspace.System
AlertV = System.AlertV

while wait() do
	if AlertV.Value == true then
		for i, v in pairs(game.Workspace:GetChildren()) do 
			if v.Name == 'CompLight' then
				v.BrickColor = BrickColor.new('Really red')
			end
		end
	end
end

Note that this script will constantly run and recolor CompLight. If this is a problem, you can try breaking the loop. I hope this helped!

7 comments

0

I'm gonna test this now!

0

it didn't work, after the value AlertV became true nothing happend at the lights... it are like 40 lights btw

0

That's odd, when I tested it out, the script ran just fine... Have you tried deleting and re-inserting the script into Workspace?

0

not yet, I will try that

0

it didn't work... I added the script that changes the value also, but that just works...

0

oh it worked!

0

Great! If you found my answer helpful, you can accept the answer and upvote.

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