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

The code I always run isn't working for the first time?

Asked by 8 years ago
Edited 8 years ago

I'm currently in the making of an info Gui that guides the player on what my place is about, and I'm adding a piece of local script code into the Gui by utilizing the MouseEnter and MouseLeaveAPI code functions to have my Gui more unique. I did this by using this API so that the FontSize of my TextButton increase from a Size18 to a Size24 font and change the color of the BackgroundColor3 to a darker shade of the same color. The BackgroundColor3 changed into the darker shade of the color as expected, however, the FontSize did not change at all, and there was no error inside the output. The code that I used to execute the commands is in a LocalScript inside two parents called 'Welcome Page' and the child of Welcome Page is 'Background'.

--\\ Services


local Player = game:GetService('Players').LocalPlayer
local Run = game:GetService('RunService')
local Continue = game:GetService('StarterGui').WelcomePage.Background.ContinueButton

--\\ Mouse enter/leave function (Continue)


function MouseEnterContinueButton()
    Continue.FontSize = Enum.FontSize.Size24
    Continue.BackgroundColor3 = Color3.new(0, 170, 225)
end


function MouseLeftContinueButton()
    Continue.FontSize = Enum.FontSize.Size18
    Continue.BackgroundColor3 = Color3.new(0, 170, 255)
end


--\\ Activate functions


Continue.MouseEnter:connect(MouseEnterContinueButton)
Continue.MouseLeave:connect(MouseLeftContinueButton)

I'm honestly confused about this, it's worked for me multiple times in the past, and now it's not working. I went back multiple times to check for grammar issues and code issues, and I didn't find one single issue inside my code. Perhaps some fresh eyes can help, can you help me on this issue? Is this a new update that Roblox has once again done, or is this an error on my side? Thanks.

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

Hello,

Try making line 04 local player = game.Players.LocalPlayer if it's also a LocalScript and is for a button only, I recommend putting it underneath the button. That would make line 06 local Continue = script.Parent That is my method, and it should work. If it does not work, reply to this comment and I will try and help you to the best of my ability. I am a little new to MouseEnter, so if I am incorrect I am terribly sorry. But yeah, every thing else seems just fine. ^-^

Thanks for reading!

Ad

Answer this question