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

GUI Frame size depending on IntValue?

Asked by
PredNova 130
9 years ago

I've been trying to make a StatsGui - Hunger, Thirst and Health. The values work fine I'm just wondering how you'd resize the frame equivilent to the value? (If Thirst = 500 then the frame would be half of the GUIs size)

plr.Character:WaitForChild("Humanoid").Running:connect(speed)
if speed > 0 then
    game.Players.LocalPlayer.Thirst.Value = game.Players.LocalPlayer.Thirst.Value - math.random(1,8)
    script.Parent.Thirst.Size = UDim2.new(0,  ____  ,0,40) -- Duno what to put in this bit...
end

The main GUI is sized: {0, 400},{0, 175} And the bar im trying to resize is set default to: {0, 160},{0, 40} - The bit that would change by the IntValue being the 160 with it's max size being 320. And the maximum value of the IntValue that should be changing the size of this, is 1000...

Any help would be much appreciated :)

0
I recommend that you use the scale of a UDim2 SurVur 86 — 9y
0
Er.. What? This is a UDim2 PredNova 130 — 9y
0
UDim2.new() takes 4 arguments. The X Scale, the X Offset, the Y Scale, the Y Offset. Using scale will base position/size off of the player's screen size. Using offset will size/position it with pixels SurVur 86 — 9y

Answer this question