if workspace.Areas:FindFirstChildOfClass("\070\111\108\100\101\114")then(require(updateEnvironment)).LoadArea((workspace.Areas:FindFirstChildOfClass("\070\111\108\100\101\114")).Name)end;(game:GetService("\082\117\110\083\101\114\118\105\099\101")):BindToRenderStep("\085\073",50,function()if players.LocalPlayer.Character and players.LocalPlayer.Character:FindFirstChild("\072\117\109\097\110\111\105\100")then if players.LocalPlayer.Character.Humanoid.Health/players.LocalPlayer.Character.Humanoid.MaxHealth>=.998 then healthFill.UIGradient.Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(1,0)})elseif players.LocalPlayer.Character.Humanoid.Health/players.LocalPlayer.Character.Humanoid.MaxHealth<=.001 then healthFill.UIGradient.Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,1);NumberSequenceKeypoint.new(1,1)})else healthFill.UIGradient.Transparency=NumberSequence.new({NumberSequenceKeypoint.new(0,0),NumberSequenceKeypoint.new(players.LocalPlayer.Character.Humanoid.Health/players.LocalPlayer.Character.Humanoid.MaxHealth,0);NumberSequenceKeypoint.new(math.clamp(players.LocalPlayer.Character.Humanoid.Health/players.LocalPlayer.Character.Humanoid.MaxHealth+.001,players.LocalPlayer.Character.Humanoid.Health/players.LocalPlayer.Character.Humanoid.MaxHealth+.001,.999),1);NumberSequenceKeypoint.new(1,1)})end healthFill.Parent.LifeLabel.Text=math.floor(players.LocalPlayer.Character.Humanoid.Health)healthFill.UIGradient.Rotation=healthFill.UIGradient.Rotation-1 healthFill.Rotation=healthFill.Rotation+1 if lastHealth>players.LocalPlayer.Character.Humanoid.Health then DamageEffect(lastHealth/players.LocalPlayer.Character.Humanoid.MaxHealth,(lastHealth-players.LocalPlayer.Character.Humanoid.Health)/players.LocalPlayer.Character.Humanoid.MaxHealth,lastHealth-players.LocalPlayer.Character.Humanoid.Health)end lastHealth=players.LocalPlayer.Character.Humanoid.Health end if players.LocalPlayer.Stats.Rank.Value>=rankCap.Value then rankLabel.TextColor3=Color3.fromRGB(255,255,0)else rankLabel.TextColor3=Color3.fromRGB(255,255,255)end if players.LocalPlayer.Stats.Mana.Value>=GetManaCap()then manaLabel.TextColor3=Color3.fromRGB(255,255,0)else manaLabel.TextColor3=Color3.fromRGB(255,255,255)end rankLabel.Text=players.LocalPlayer.Stats.Rank.Value goldLabel.Text=players.LocalPlayer.Stats.Gold.Value arrowsLabel.Text=players.LocalPlayer.Stats.Arrows.Value manaLabel.Text=players.LocalPlayer.Stats.Mana.Value rankBar.Parent.Label.Text=players.LocalPlayer.Stats.XP.Value..("\047"..(replicatedStorage.ServerSettings.XPPerRank.Value*players.LocalPlayer.Stats.Rank.Value.." \088\080"))rankBar.Position=UDim2.new(players.LocalPlayer.Stats.XP.Value/(replicatedStorage.ServerSettings.XPPerRank.Value*players.LocalPlayer.Stats.Rank.Value)-1,0,0,0)rankBar.Fill.Position=UDim2.new(1-players.LocalPlayer.Stats.XP.Value/(replicatedStorage.ServerSettings.XPPerRank.Value*players.LocalPlayer.Stats.Rank.Value),0,0,0)end)
-- Load default environment
if workspace.Areas:FindFirstChildOfClass("Folder") then
	require(updateEnvironment).LoadArea(workspace.Areas:FindFirstChildOfClass("Folder").Name)
end

game:GetService("RunService"):BindToRenderStep("UI", 50, function() -- Update and animate health UI
	if players.LocalPlayer.Character and players.LocalPlayer.Character:FindFirstChild("Humanoid") then
		if
			players.LocalPlayer.Character.Humanoid.Health / players.LocalPlayer.Character.Humanoid.MaxHealth >= 0.998
		then
			healthFill.UIGradient.Transparency =
				NumberSequence.new({ NumberSequenceKeypoint.new(0, 0), NumberSequenceKeypoint.new(1, 0) })
		elseif
			players.LocalPlayer.Character.Humanoid.Health / players.LocalPlayer.Character.Humanoid.MaxHealth <= 0.001
		then
			healthFill.UIGradient.Transparency =
				NumberSequence.new({ NumberSequenceKeypoint.new(0, 1), NumberSequenceKeypoint.new(1, 1) })
		else
			healthFill.UIGradient.Transparency = NumberSequence.new({
				NumberSequenceKeypoint.new(0, 0),
				NumberSequenceKeypoint.new(
					players.LocalPlayer.Character.Humanoid.Health / players.LocalPlayer.Character.Humanoid.MaxHealth,
					0
				),
				NumberSequenceKeypoint.new(
					math.clamp(
						(
							players.LocalPlayer.Character.Humanoid.Health
							/ players.LocalPlayer.Character.Humanoid.MaxHealth
						) + 0.001,
						(
							players.LocalPlayer.Character.Humanoid.Health
							/ players.LocalPlayer.Character.Humanoid.MaxHealth
						) + 0.001,
						0.999
					),
					1
				),
				NumberSequenceKeypoint.new(1, 1),
			})
		end
		healthFill.Parent.LifeLabel.Text = math.floor(players.LocalPlayer.Character.Humanoid.Health)
		healthFill.UIGradient.Rotation = healthFill.UIGradient.Rotation - 1
		healthFill.Rotation = healthFill.Rotation + 1
		if lastHealth > players.LocalPlayer.Character.Humanoid.Health then
			DamageEffect(
				lastHealth / players.LocalPlayer.Character.Humanoid.MaxHealth,
				(lastHealth - players.LocalPlayer.Character.Humanoid.Health)
					/ players.LocalPlayer.Character.Humanoid.MaxHealth,
				lastHealth - players.LocalPlayer.Character.Humanoid.Health
			)
		end
		lastHealth = players.LocalPlayer.Character.Humanoid.Health
	end
	-- Update other stuff in UI
	if players.LocalPlayer.Stats.Rank.Value >= rankCap.Value then
		rankLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
	else
		rankLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
	end
	if players.LocalPlayer.Stats.Mana.Value >= GetManaCap() then
		manaLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
	else
		manaLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
	end
	rankLabel.Text = players.LocalPlayer.Stats.Rank.Value
	goldLabel.Text = players.LocalPlayer.Stats.Gold.Value
	arrowsLabel.Text = players.LocalPlayer.Stats.Arrows.Value
	manaLabel.Text = players.LocalPlayer.Stats.Mana.Value
	rankBar.Parent.Label.Text = players.LocalPlayer.Stats.XP.Value
		.. "/"
		.. replicatedStorage.ServerSettings.XPPerRank.Value * players.LocalPlayer.Stats.Rank.Value
		.. " XP"
	rankBar.Position = UDim2.new(
		(
			players.LocalPlayer.Stats.XP.Value
			/ (replicatedStorage.ServerSettings.XPPerRank.Value * players.LocalPlayer.Stats.Rank.Value)
		) - 1,
		0,
		0,
		0
	)
	rankBar.Fill.Position = UDim2.new(
		1
			- players.LocalPlayer.Stats.XP.Value
				/ (replicatedStorage.ServerSettings.XPPerRank.Value * players.LocalPlayer.Stats.Rank.Value),
		0,
		0,
		0
	)
end)
