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

How do I fix the script failing to change its parents size?

Asked by
AltNature 169
5 years ago

Here is the script.

local Shop = script.Parent

Shop.MouseEnter:Connect(function()
    Shop.Size = {0.2, 100},{0, 100}
end)

Shop.MouseLeave:Connect(function()
    Shop.Size = {0, 100},{0, 100}
end)


its a simple script.

It gives me these errors --

17:44:05.847 - Players.AltNature.PlayerGui.ScreenGui.ShopGuiLabel.Script:4: bad argument #3 to 'Size' (UDim2 expected, got table)

17:44:06.749 - Players.AltNature.PlayerGui.ScreenGui.ShopGuiLabel.Script:8: bad argument #3 to 'Size' (UDim2 expected, got table)

1 answer

Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

The error explains itself. You gave it a table when it expects a UDim2.

local Shop = script.Parent

Shop.MouseEnter:Connect(function()
    Shop.Size = UDim2.new(0.2, 100, 0, 100) -- assign Size like this. 
end)

Shop.MouseLeave:Connect(function()
    Shop.Size = UDim2.new(0, 100, 0, 100) -- here too
end)
Ad

Answer this question