Udim2.new Error

I’m trying to make it so that when your mouse hovers over a GUI it expands.

image

I have tried looking at the Dev Hub but it backed up my code, can anyone help?

script.Parent.MouseEnter:Connect(function()
    script.Parent:TweenSize(UDim2.new(0, 205, 0, 48) "Out", "Linear", 0.1, true)
    script.click:Play()
    print("Hi")
end)

script.Parent.MouseLeave:Connect(function()
    script.Parent:TweenSize(UDim2.new(0, 205, 0, 42) "In", "Linear", 0.1, true)
end)

As far as I can tell, the only error here would be that there is no comma after the UDim2 in TweenSize.

script.Parent.MouseEnter:Connect(function()
    script.Parent:TweenSize(UDim2.new(0, 205, 0, 48), "Out", "Linear", 0.1, true)
    script.click:Play()
    print("Hi")
end)

script.Parent.MouseLeave:Connect(function()
    script.Parent:TweenSize(UDim2.new(0, 205, 0, 42), "In", "Linear", 0.1, true)
end)
2 Likes

I don’t think you need to put a comma after Udim2.new

I think they’re right. You might want to try putting a comma after Udim2.new.

Bro idk what I changed but your original one didnt work, I rewrote it and it works now.

script.Parent.MouseEnter:Connect(function()
	script.Parent:TweenSize(UDim2.new(0, 205, 0, 48), "Out", "Linear", 0.1, true)
	script.click:Play()
	print("Hi")
end)

script.Parent.MouseLeave:Connect(function()
	script.Parent:TweenSize(UDim2.new(0, 205, 0, 42), "In", "Linear", 0.1, true)
end)

I know what I did differently, I added a comma after your UDim2.new(0, 205, 0, 48)
Like the people above were telling you.

So instead of
script.Parent:TweenSize(UDim2.new(0, 205, 0, 42) "In", "Linear", 0.1, true)
its
script.Parent:TweenSize(UDim2.new(0, 205, 0, 42), "In", "Linear", 0.1, true)

1 Like