Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What did I do wrong with this GUI code?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.