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

How Can I Turn A Model From Bright Bluish Green To Bright Orange And Back With One Button?

To turn my Base1 item all into the same color i use this script in a button:

function onTouch(part)
	local humanoid = part.Parent:FindFirstChild("Humanoid") 
	if (humanoid ~= nil) then
		for i,v in pairs(game.Workspace.Base1:GetChildren()) do
		v.BrickColor = BrickColor.new(106)
end
	end
end

script.Parent.Touched:connect(onTouch)

But I want to change it to orange, then if i touch it again i want it to be teal/ bright bluish green

1 answer

✓ Accepted answer
var1 = true
function onTouch(part)
	local humanoid = part.Parent:FindFirstChild("Humanoid")
	if humanoid ~= nil then
		if var1 == true then
			wait(.5)
			for i, v in pairs(game.Workspace.Base1:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright red") --Whatever color you want it to change inside the parenthesis
			end
			var1 = false
		elseif var1 == false then
			wait(.5)
			for i, v in pairs(game.Workspace.Base1:GetChildren()) do
				v.BrickColor = BrickColor.new("Bright blue") --Whatever color you want it to change second inside the parenthesis
			end
			var1 = true
		end
	end
end
script.Parent.Touched:connect(onTouch)

Hope this helped!

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