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
8 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


local player = game.Players.LocalPlayer local stats = player:FindFirstChild('leaderstats') if not stats then return end local rep = stats:FindFirstChild('Reputation') if not rep then return end local kills = stats:FindFirstChild('Kills') if not kills then return end while true do wait(1.5) script.Parent.Hydration.Bar.Size = script.Parent.Hydration.Bar.Size - UDim2.new(0, 1, 0, 0) if script.Parent.Hydration.Bar.Size ~= UDim2.new(0, 0, 0, 15) then end if script.Parent.Hydration.Bar.Size == UDim2.new(0, 0, 0, 15) then while true do wait(1.5) player.Character.Humanoid.Health = game.Players.LocalPlayer.Character.Humanoid.Health - 6 if kills.Value == kills.Value + 1 then player.Character.Humanoid.Health = game.Players.LocalPlayer.Character.Humanoid.Health + 6 end end else end end

1 answer

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

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

while 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, 2, 0, 15) then
15
    end
16
    if script.Parent.Hydration.Bar.Size == UDim2.new(0, 2, 0, 15) then
17
        while true do

Ad

Answer this question