MouseEnter not working on surfaceGUI

Hello, Im basicly trying to make it so it changes color and does a little cool tween. I don’t know if MouseEnter work’s with SurfaceUI’s.

If anyone have ever fixed this problem I would be happy, or give me important feedback on why this glitch is not working.

1 Like

Code:

    local frame = script.Parent
    frame.Position = UDim2.new(0.02 , 0 , 0.02, 0)
    frame.BackgroundColor3 = Color3.new(0, 0.572549, 0.701961)
end)```
1 Like

Is the SurfaceGui adorned and parented to the part prior to you testing the game? Because if that’s the case, you must move it to the StarterGui and adorn it to the part from there.

2 Likes

I did do that but it’s not working

2 Likes

I see. Based on your code, it looks as if you only pasted part of it because I see nothing related to MouseEnter events. Can I see the entire code?

1 Like
script.Parent.MouseEnter:Connect(function()
    local frame = script.Parent
    frame.Position = UDim2.new(0.02 , 0 , 0.02, 0)
    frame.BackgroundColor3 = Color3.new(0, 0.572549, 0.701961)
end)```
1 Like

Ah it would appear that in the line where you state the BackgroundColor3, you missed one number within the Color3.new(). If you put in the 4th one it should work.

1 Like

No errors though? Im going to try

1 Like

Still Nope I think it just doesnt work

1 Like

That’s odd. I just tested it your code out on a new place and it works fine for me.

In the script.Parent variable, is it referring directly to the frame you want the color to change for? That’s all I can think of if it still isn’t working.

1 Like

Try a surface UI
Thats I use .

1 Like

Yeah, I’m using a SurfaceGUI. I made sure to parent it to the StarterGUI and then adorn it to a part in Workspace. Then I copy and pasted your script into a LocalScript parented to a Frame in the SurfaceGUI. I can send a place download if you like.

1 Like

Does it work in the client? Try that

1 Like

Yeah, it works on the client. SurfaceGUI changes should only happen on the clint anyway as they’re always to be parented to each player’s StarterGUI.

1 Like

Show me your code, if possible adronne and everything

Example.rbxl (23.9 KB)

In this example, I’ve put a SurfaceGUI in the StarterGUI and adorned it to the Baseplate. The LocalScript containing your code is parented to a Frame in the SurfaceGUI.

Thank you so much, It worked! Lmao

1 Like