local mainGui = game.StarterGui.MainGui local shopButton = mainGui.ShopButton local shopHoverC = 10,20,10 local shopHoverS = 15,5,10,0 function shopButtonHovering() shopButton.Size = Udim2.new(shopHoverS) shopButton.BackgroundColor3 = Color3.new(shopHoverC) end
I want it that when a player’s mouse hovers on shopButton
it will run the function.
Is there some event that makes it work? Also should it be in a LocalScript? Thanks!
You can simply use the MouseEnter function
local mainGui = game.StarterGui.MainGui local shopButton = mainGui.ShopButton local shopHoverC = 10,20,10 local shopHoverS = 15,5,10,0 function shopButtonHovering() shopButton.Size = Udim2.new(shopHoverS) shopButton.BackgroundColor3 = Color3.new(shopHoverC) end shopButton.MouseEnter:Connect(shopButtonHovering)
There is an event called "MouseEnter" in TextButton
script.Parent.MouseEnter:Connect(function() script.Parent.TextColor3 = Color3.fromRGB(255, 255, 255) end)
script.Parent.MouseLeave:Connect(function() script.Parent.TextColor3 = Color3.fromRGB(0, 0, 0) end)