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

Colour not changing and reseting?

I have constructed a gui and having problems with the script inside of a "Text Button" The area which I am referring to for my script is Game -StarterGUI --ScreenGUI ---HomeFrame (FRAME) ----(All my text buttons)

---TriggerFrame (FRAME) ----Trigger1 (TEXT BUTTON) ----Return (TEXT BUTTON) -----Script

function onClicked(mouse)
script.Parent.BackgroundColor3 = Color3.new(85, 0, 127)
end

if Homeframe.visible = true then do
	game.StarterGui.ScreenGui.TriggerFrame.Trigger1.BackgroundColor3 = Color3.new(85, 0, 127)
end

	
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

I basically want it so If you click the Trigger1 button it will make it a purple color and when you press the return button it puts you onto the HomeFrame which resets the color of Trigger 1 back to the normal 255, 255, 255

1 answer

local player = game.Players.LocalPlayer
local Homeframe = player.PlayerGui.ScreenGui.HomeFrame

function onClicked()
	script.Parent.BackgroundColor3 = Color3.new(85, 0, 127)
	if Homeframe.Visible == true then
		player.PlayerGui.ScreenGui.TriggerFrame.Trigger1.BackgroundColor3 = Color3.new(85, 0, 127)
	end
end

script.Parent.MouseButton1Down:connect(onClicked)

Try this

Might not work...

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