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

What did I do wrong with this GUI code?

Asked by
Xl5Xl5 65
9 years ago

This is just a LocalScript inside a ScreenGUI, its in StarterGui and everything. I get no errors in the output, and the GUI disappears the second I am in the game.

please help

01local player = game.Players.LocalPlayer
02local stats = player:FindFirstChild('leaderstats')
03    if not stats then return end
04 
05local rep = stats:FindFirstChild('Reputation')
06    if not rep then return end
07 
08local kills = stats:FindFirstChild('Kills')
09if not kills then return end
10 
11while true do
12    wait(1.5)
13    script.Parent.Hydration.Bar.Size = script.Parent.Hydration.Bar.Size - UDim2.new(0, 1, 0, 0)
14    if script.Parent.Hydration.Bar.Size ~= UDim2.new(0, 0, 0, 15) then
15    end
View all 26 lines...

1 answer

Log in to vote
0
Answered by
fdfxd 50
9 years ago

Because of the udims, x offset and scale are zero, that's why

01while true do
0212
03    wait(1.5)
0413
05    script.Parent.Hydration.Bar.Size = script.Parent.Hydration.Bar.Size - UDim2.new(0, 1, 0, 0)
0614
07    if script.Parent.Hydration.Bar.Size ~= UDim2.new(0, 2, 0, 15) then
0815
09    end
1016
11    if script.Parent.Hydration.Bar.Size == UDim2.new(0, 2, 0, 15) then
1217
13        while true do
Ad

Answer this question