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

Why isn't MouseEnter and MouseLeave not working on my surfaceGui?

It's pretty simple, for some reason it doesn't want to detect that my mouse is on the TextButton

script.Parent.MouseEnter:Connect(function()
	print("Hi mouse! :D")
	game:GetService('TweenService'):Create(
	script.Parent.Round ,TweenInfo.new(0.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
	{ImageColor3 = Color3.fromRGB(46, 154, 255)}):Play()
	
	game:GetService('TweenService'):Create(
	script.Parent.TextLabel.TextColor3 ,TweenInfo.new(0.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
	{ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()
end)

script.Parent.MouseLeave:Connect(function()
	print("Bye mouse. D:")
	game:GetService('TweenService'):Create(
	script.Parent.Round ,TweenInfo.new(0.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
	{ImageColor3 = Color3.fromRGB(255, 255, 255)}):Play()

	game:GetService('TweenService'):Create(
	script.Parent.TextLabel.TextColor3 ,TweenInfo.new(0.25,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut),
	{ImageColor3 = Color3.fromRGB(46, 154, 255)}):Play()

end)

6 comments

0

Are you using this in a local script or script? I tested the code and it worked, but it will only work if its in a script. Using a local script will not work.

0

I used it in a normal script I believe. Let me check real quick.

0

Yep, normal script. May it be that I tween'ed the camera at first?

0

Tried the surfacegui alone without any camera movement. Still doesn't work.

0

Don't worry I fixed it!

0

Great glad to hear, must have been something simple, as I just copy pasted your code into a surfacegui and it worked. Goodluck on your coding adventures!

1 answer

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