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

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

Asked by 3 years ago

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)
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. WizyTheNinja 834 — 3y
0
I used it in a normal script I believe. Let me check real quick. crousei 2 — 3y
0
Yep, normal script. May it be that I tween'ed the camera at first? crousei 2 — 3y
0
Tried the surfacegui alone without any camera movement. Still doesn't work. crousei 2 — 3y
View all comments (2 more)
0
Don't worry I fixed it! crousei 2 — 3y
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! WizyTheNinja 834 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

Update: Fixed it and everything is working.

Ad

Answer this question