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

How To Perform An Action Depending On A ScreenGui's Size?

Asked by 8 years ago

Hello!

Thank you for looking at my question today! I've been working with Tweening and want a specific action to happen with a Gui Size is at {0, 200, 0, 200}

I know it sounds confusing but...

I want to be able to check a Gui's Size and Position via script (Or Local Script), for example, if A gui's size is {0, 200, 0, 200}, how would I check it and perform an action if that size is true?

What I think could work...

I have a theory code (which means I believe this will work)

local Frame= game.StarterGui.ScreenGui.Frame

local Part = workspace.Part

if Frame.Size = UDim2.new(0, 200, 0, 200) then

Part.Color3 = Color3.new(197/255)

end

So...

Will this even work? Or is there an easier method to product this check? Would this work with Tweening as well or not? Thanks for looking at my question, have a great day!

2 answers

Log in to vote
0
Answered by 8 years ago

You can't directly input and UDim2 value in an if statement, so use specific properties of them instead.

Example:

local Frame= game.StarterGui.ScreenGui.Frame

local Part = workspace.Part

if Frame.Size.X.Offset == 200 and Frame.Size.Y.Offset == 200 then

-- Code here

end

"u used Color3.new, thats not the right color value for parts. thats for gui colors." Color3.new works for BasePart instances.

Ad
Log in to vote
-1
Answered by 8 years ago

you need a script that checks when something is changed= OnChange()

your script, it happens only once.

BrickColor!

u used Color3.new, thats not the right color value for parts. thats for gui colors.

0
So how would that work? GreekGodOfMLG 244 — 8y
0
i fkin hate writeing answers, its a certainty that some noob will down vote it ConnorVIII 448 — 8y

Answer this question