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

How would i make a script where when the mouse is hoverd then the gui changes to diffrent colors?

Ive been trying but i cant seem to crack it i dont really know

3 comments

0

use the MouseEnter and MouseLeave functions ...

0

You mean when the mouse is in the GUI?

0

Hmm let me get studio open and test some things.  JK I can't get on RBLX Studio rn

2 answers

Okay, this would be the most found way I see right now in my mind I'm not at a computer right now to check the code, but I think this will work! PS I made it where It changes it back to white if there is no mouse

--\\ A value that makes sure the mouse is in the frame
local MouseIn = false

--\\ Mouse Button Entry
script.Parent.MouseEnter:connect(function()
    MouseIn=true
end)
--\\ Mouse Button Leave
script.Parent.MouseLeave:connect(function()
    MouseIn=false
end)

--\\ Frame Changer
while true do   wait(.1)
	if MouseIn then script.Parent.BackgroundColor3=Color3.new(math.random(0,1),math.random(0,1),
math.random(0,1)) 
	else 
	script.Parent.BackgroundColor3=Color3.new(255,255,255) end
end

1 comment

0

this script will lag the game with that while loop

I may have to edit it to tell it that the frame is what i want it to be in

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