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

Size of gui not changing??

Asked by
Danfly 5
9 years ago

Why won't it change the shape of a gui when you click on the gui button??? Please help!

function onClick(mouse)
    script.Parent.Parent.Parent.Frame.OPEN.Size.X.Offset ="75"
end

script.Parent.MouseButton1Click:connect(onClick)

2 answers

Log in to vote
1
Answered by 9 years ago
function onClick(mouse)
    script.Parent.Parent.Parent.Frame.OPEN.Size = UDim2.new(0,75,0,0)
end

script.Parent.MouseButton1Click:connect(onClick)

http://wiki.roblox.com/index.php?title=Tweening http://wiki.roblox.com/index.php/UDim2

2
In the future, please post an explanation along with code. Perci1 4988 — 9y
0
Ok. ITSolarWinds 25 — 9y
Ad
Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

To explain SolarWind's answer: you cannot set the individual members of an Object's property, you have to set the whole property at once. A GUI's Size property is a UDim2 data type, you you have to use that.

To only change one property, you have to be to be more careful than what Solar did as well:

local bin =  script.Parent.Parent.Parent.Frame.OPEN
function onClick(mouse)
   bin.Size = UDim2.new(bin.X.Scale, 75, bin.Y.Scale, bin.Y.Offset)
end

script.Parent.MouseButton1Click:connect(onClick)

Changing the GUI's size to ({0, 75};{0, 0}) has the problem of having absolutely no height.

Answer this question