I created this script that is supposed to change the size of a button when you hover over it, and then go back once you leave the hover, but when you hover its completely disappears, and when checked, both its position and size are 0. Here is the script.
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Canvas = script.Parent
function showPointer()
Canvas.Size = UDim2.new{0.231, 0},{0.192, 0}
Canvas.Position = UDim2.new{0.384, 0},{0.701, 0}
end
function hidePointer()
Canvas.Size = UDim2.new{0.218, 0},{0.181, 0}
Canvas.Position = UDim2.new{0.391, 0},{0.701, 0}
end
Canvas.MouseEnter:Connect(showPointer)
Canvas.MouseLeave:Connect(hidePointer)
Instead of UDim2.new{0.218, 0},{0.181, 0}, use UDim2.new(0.213, 0, 0.181, 0).
Also, google how to use certain functions before going straight to the DevForum. The wiki page for UDim2’s show you how to construct one, and the wiki is always my first go-to. If not the wiki, then I google. If not then, THEN I post here.
You’re using incorrect syntax for UDim2.new(). If you try to run that script, it will give you an error saying unexpected symbol near ',' because you’re using curly brackets instead of parentheses to call a function. Read my previous reply to see a solution to that, then go to the wiki page for UDim2 to see how to construct them.
Oh true. I only tried running it in the command line in Studio.
Halalaluyafail3 is correct. You can’t call UDim2.new() with an array, you just need 4 numbers. Again, read the wiki page for UDim2 to see how to construct one properly.