#i want to change background color while pressed
29 messages · Page 1 of 1 (latest)
I think there are functions
That active when button is pressed and hold
And when there are released
U can use that
button.MouseButton1Down:Connect(function()
background.BrickColor = BrickColor.red
end
its gui
its not a brick
** You are now Level 1! **
its a gui
what is the functions?
It prob would be mouse something
** You are now Level 5! **
When you click on the GUI?
yep
Frame or button?
button
button.MouseButton1Click:Connect(function()
button.BackgroundColor3 = Color.new(1,1,1)
end
script / local script?
use a toggle to detect when its on and off
local colortoggle = false
urbutton.MouseButton1Down:Connect(function()
if not colortoggle then
colortoggle = true
frame.BackgroundColor3 = Color3.fromRGB(0,0,0) -- the color u want when its on
else
colortoggle = false
frame.BackgroundColor3 = Color3.fromRGB(0,0,0) -- the color u want when its off
end)
dont make a thread like this all the time tho, i recommend using google before anything
theirs probably plenty of resources telling u how to achieve this if u search it up 👍
thx
and how its when i pressed the color change?
not click
huh
-- Define variables
local button = script.Parent.Button
local originalColor = button.BackgroundColor3
local newColor = Color3.fromRGB(255, 0, 0) -- Replace with desired new color
local changeTime = 3 -- Replace with desired change time in seconds
-- Function to change the color of the button
local function changeButtonColor()
button.BackgroundColor3 = newColor
wait(changeTime)
button.BackgroundColor3 = originalColor
end
-- Connect the function to the button's "Activated" event
button.Activated:Connect(changeButtonColor)
-- made by AimbotR_bro1, if you would like to contribute to a donation dm on discord, daddy m#8718