Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Colour not changing and reseting?

Asked by
Danfly 5
8 years ago

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

Log in to vote
-2
Answered by
Potlon 35
8 years ago
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...

Ad

Answer this question