local c=0 local m=gameUI:WaitForChild("\072\085\068")local V=m:WaitForChild("\071\111\108\100\076\097\098\101\108")local R=m:WaitForChild("\071\111\108\100\073\110\099\114\101\097\115\101\076\097\098\101\108")local O=(m:WaitForChild("\082\097\110\107")):WaitForChild("\082\097\110\107")local L=(m:WaitForChild("\068\101\102\101\110\115\101")):WaitForChild("\068\101\102\101\110\115\101")local Z=(m:WaitForChild("\065\114\114\111\119\115")):WaitForChild("\065\114\114\111\119\115")local D=(m:WaitForChild("\077\097\110\097")):WaitForChild("\077\097\110\097")local f=(m:WaitForChild("\072\101\097\108\116\104")):WaitForChild("\070\105\108\108")f.Parent:WaitForChild("\076\105\102\101\076\097\098\101\108")f:WaitForChild("\085\073\071\114\097\100\105\101\110\116")local d=(m:WaitForChild("\082\097\110\107\066\097\114")):WaitForChild("\070\105\108\108\067\117\116\111\102\102")d:WaitForChild("\070\105\108\108")d.Parent:WaitForChild("\076\097\098\101\108")local v=(replicatedStorage:WaitForChild("\077\111\100\117\108\101\115")):WaitForChild("\083\119\105\116\099\104\077\101\110\117")function DamageEffect(c,m,V)(require(playSoundEffect))("\072\117\114\116"..math.random(1,2))local R=Instance.new("\070\114\097\109\101")R.BorderSizePixel=0 R.Size=UDim2.new(1,0,m,0)R.Position=UDim2.new(0,0,1-c,0)R.ZIndex=3 R.BackgroundColor3=Color3.fromRGB(255,255,255)R.Parent=f.Parent;((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(R,TweenInfo.new(.3),{BackgroundColor3=Color3.fromRGB(255,0,0);BackgroundTransparency=1})):Play();(game:GetService("\068\101\098\114\105\115")):AddItem(R,.5)local O=Instance.new("\084\101\120\116\076\097\098\101\108")O.Font=Enum.Font.SourceSansBold O.BackgroundTransparency=1 O.TextScaled=true O.TextColor3=Color3.fromRGB(255,255,255)O.TextStrokeTransparency=0 O.Text="-"..math.floor(V)O.TextColor3=Color3.fromRGB(255,0,0)O.Size=UDim2.new(1,0,.35,0)O.Position=UDim2.new(1,0,.325,0)O.Parent=f.Parent;((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(O,TweenInfo.new(.75,Enum.EasingStyle.Linear),{Position=O.Position-UDim2.new(0,0,.35,0);TextTransparency=1;TextStrokeTransparency=1})):Play();(game:GetService("\068\101\098\114\105\115")):AddItem(O,1)end function RankUpEffect()local c=O.Parent:WaitForChild("\082\097\110\107\085\112")if c.ImageTransparency==1 then(require(playSoundEffect))("\082\097\110\107\085\112");((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(c,TweenInfo.new(.001),{Size=UDim2.new(1,0,1,0);Position=UDim2.new(0,0,0,0);Rotation=0})):Play()wait();((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(c,TweenInfo.new(.3,Enum.EasingStyle.Linear),{Size=UDim2.new(3,0,3,0),Position=UDim2.new(-1,0,-1,0),Rotation=40,ImageTransparency=0})):Play()wait(.3);((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(c,TweenInfo.new(.5,Enum.EasingStyle.Linear),{Size=UDim2.new(6,0,6,0);Position=UDim2.new(-2.5,0,-2.5,0),Rotation=80,ImageTransparency=1})):Play()end end function XPIncreaseEffect(c)local m=d.Parent:WaitForChild("\071\108\111\119")local V=d.Parent:WaitForChild("\073\110\099\114\101\097\115\101")V.Text="\043"..c;((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(m,TweenInfo.new(.001),{ImageTransparency=0})):Play();((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(V,TweenInfo.new(.001),{TextTransparency=0;TextStrokeTransparency=0})):Play()wait();((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(m,TweenInfo.new(.3,Enum.EasingStyle.Linear),{ImageTransparency=1})):Play();((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(V,TweenInfo.new(3,Enum.EasingStyle.Linear),{TextTransparency=1,TextStrokeTransparency=1})):Play()end function GoldIncreaseEffect(c)R.Text="\043"..c;((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(R,TweenInfo.new(.001),{TextTransparency=0;TextStrokeTransparency=0})):Play()wait();((game:GetService("\084\119\101\101\110\083\101\114\118\105\099\101")):Create(R,TweenInfo.new(3,Enum.EasingStyle.Linear),{TextTransparency=1;TextStrokeTransparency=1})):Play()end function UpdateDefense()local c=replicatedStorage.Armor:FindFirstChild(players.LocalPlayer.Stats.CurrentArmor.Value)if c then L.Text=c.Defense.Value else L.Text="\048"end end;(m:WaitForChild("\065\114\109\111\114")).MouseButton1Click:Connect(function()(require(v))("\065\114\109\111\114\069\113\117\105\112\077\101\110\117")end);(m:WaitForChild("\065\116\116\114\105\098\117\116\101\115")).MouseButton1Click:Connect(function()(require(v))("\065\116\116\114\105\098\117\116\101\115\077\101\110\117")end);(m:WaitForChild("\083\112\097\119\110")).MouseButton1Click:Connect(function()local c=workspace.Remotes.ReturnToSpawn:InvokeServer()if c then(require(updateEnvironment)).LoadArea(c)end end);(m:WaitForChild("\081\117\101\115\116\115")).MouseButton1Click:Connect(function()(require(v))("\081\117\101\115\116\115\077\101\110\117")end)function GetManaCap()local c=(game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).ServerSettings return c.StartingMana.Value+c.ManaBoostPerMythicality.Value*players.LocalPlayer.Attributes.Mythicality.Value end local a=(game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).ServerSettings.RankCap local b=(players.LocalPlayer:WaitForChild("\083\116\097\116\115")):WaitForChild("\071\111\108\100")local y=(players.LocalPlayer:WaitForChild("\083\116\097\116\115")):WaitForChild("\088\080")local G=(players.LocalPlayer:WaitForChild("\083\116\097\116\115")):WaitForChild("\082\097\110\107")local q=(players.LocalPlayer:WaitForChild("\083\116\097\116\115")):WaitForChild("\067\117\114\114\101\110\116\065\114\109\111\114")local o=b.Value local W=y.Value local n=G.Value b.Changed:Connect(function()if b.Value>o then GoldIncreaseEffect(math.floor(b.Value-o))end o=b.Value end)y.Changed:Connect(function()if y.Value>W then XPIncreaseEffect(math.floor(y.Value-W))end W=y.Value end)G.Changed:Connect(function()if G.Value>n then RankUpEffect()end n=G.Value end)UpdateDefense()q.Changed:Connect(UpdateDefense)

local lastHealth = 0
local hud = gameUI:WaitForChild("HUD")
local goldLabel = hud:WaitForChild("GoldLabel")
local goldIncreaseLabel = hud:WaitForChild("GoldIncreaseLabel")
local rankLabel = hud:WaitForChild("Rank"):WaitForChild("Rank")
local defenseLabel = hud:WaitForChild("Defense"):WaitForChild("Defense")
local arrowsLabel = hud:WaitForChild("Arrows"):WaitForChild("Arrows")
local manaLabel = hud:WaitForChild("Mana"):WaitForChild("Mana")
local healthFill = hud:WaitForChild("Health"):WaitForChild("Fill")
healthFill.Parent:WaitForChild("LifeLabel")
healthFill:WaitForChild("UIGradient")
local rankBar = hud:WaitForChild("RankBar"):WaitForChild("FillCutoff")
rankBar:WaitForChild("Fill")
rankBar.Parent:WaitForChild("Label")
local switchMenu = replicatedStorage:WaitForChild("Modules"):WaitForChild("SwitchMenu")

function DamageEffect(originalPercentage, damagePercentage, amount)
	require(playSoundEffect)("Hurt" .. math.random(1,2))
	local effect = Instance.new("Frame")
	effect.BorderSizePixel = 0
	effect.Size = UDim2.new(1, 0, damagePercentage, 0)
	effect.Position = UDim2.new(0, 0, 1 - originalPercentage, 0)
	effect.ZIndex = 3
	effect.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
	effect.Parent = healthFill.Parent
	game:GetService("TweenService"):Create(effect, TweenInfo.new(0.3), {BackgroundColor3 = Color3.fromRGB(255, 0, 0), BackgroundTransparency = 1}):Play()
	game:GetService("Debris"):AddItem(effect, 0.5)
	local indicator = Instance.new("TextLabel")
	indicator.Font = Enum.Font.SourceSansBold
	indicator.BackgroundTransparency = 1
	indicator.TextScaled = true
	indicator.TextColor3 = Color3.fromRGB(255, 255, 255)
	indicator.TextStrokeTransparency = 0
	indicator.Text = "-" .. math.floor(amount)
	indicator.TextColor3 = Color3.fromRGB(255, 0, 0)
	indicator.Size = UDim2.new(1, 0, 0.35, 0)
	indicator.Position = UDim2.new(1, 0, 0.325, 0)
	indicator.Parent = healthFill.Parent
	game:GetService("TweenService"):Create(indicator, TweenInfo.new(0.75, Enum.EasingStyle.Linear), {Position = indicator.Position - UDim2.new(0, 0, 0.35, 0), TextTransparency = 1, TextStrokeTransparency = 1}):Play()
	game:GetService("Debris"):AddItem(indicator, 1)
end

function RankUpEffect()
	local rankUpGlow = rankLabel.Parent:WaitForChild("RankUp")
	if rankUpGlow.ImageTransparency == 1 then
		require(playSoundEffect)("RankUp")
		game:GetService("TweenService"):Create(rankUpGlow, TweenInfo.new(0.001), {Size = UDim2.new(1, 0, 1, 0), Position = UDim2.new(0, 0, 0, 0), Rotation = 0}):Play()
		wait()
		game:GetService("TweenService"):Create(rankUpGlow, TweenInfo.new(0.3, Enum.EasingStyle.Linear), {Size = UDim2.new(3, 0, 3, 0), Position = UDim2.new(-1, 0, -1, 0), Rotation = 40, ImageTransparency = 0}):Play()
		wait(0.3)
		game:GetService("TweenService"):Create(rankUpGlow, TweenInfo.new(0.5, Enum.EasingStyle.Linear), {Size = UDim2.new(6, 0, 6, 0), Position = UDim2.new(-2.5, 0, -2.5, 0), Rotation = 80, ImageTransparency = 1}):Play()
	end
end

function XPIncreaseEffect(amount)
	local glow = rankBar.Parent:WaitForChild("Glow")
	local increase = rankBar.Parent:WaitForChild("Increase")
	increase.Text = "+" .. amount
	game:GetService("TweenService"):Create(glow, TweenInfo.new(0.001), {ImageTransparency = 0}):Play()
	game:GetService("TweenService"):Create(increase, TweenInfo.new(0.001), {TextTransparency = 0, TextStrokeTransparency = 0}):Play()
	wait()
	game:GetService("TweenService"):Create(glow, TweenInfo.new(0.3, Enum.EasingStyle.Linear), {ImageTransparency = 1}):Play()
	game:GetService("TweenService"):Create(increase, TweenInfo.new(3, Enum.EasingStyle.Linear), {TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end

function GoldIncreaseEffect(amount)
	goldIncreaseLabel.Text = "+" .. amount
	game:GetService("TweenService"):Create(goldIncreaseLabel, TweenInfo.new(0.001), {TextTransparency = 0, TextStrokeTransparency = 0}):Play()
	wait()
	game:GetService("TweenService"):Create(goldIncreaseLabel, TweenInfo.new(3, Enum.EasingStyle.Linear), {TextTransparency = 1, TextStrokeTransparency = 1}):Play()
end

function UpdateDefense()
	local armor = replicatedStorage.Armor:FindFirstChild(players.LocalPlayer.Stats.CurrentArmor.Value)
	if armor then
		defenseLabel.Text = armor.Defense.Value
	else
		defenseLabel.Text = "0"
	end
end

hud:WaitForChild("Armor").MouseButton1Click:Connect(function()
	require(switchMenu)("ArmorEquipMenu")
end)

hud:WaitForChild("Attributes").MouseButton1Click:Connect(function()
	require(switchMenu)("AttributesMenu")
end)

hud:WaitForChild("Spawn").MouseButton1Click:Connect(function()
	local areaName = workspace.Remotes.ReturnToSpawn:InvokeServer()
	if areaName then
		require(updateEnvironment).LoadArea(areaName)
	end
end)

hud:WaitForChild("Quests").MouseButton1Click:Connect(function()
	require(switchMenu)("QuestsMenu")
end)

function GetManaCap()
	local serverSettings = game:GetService("ReplicatedStorage").ServerSettings
	return serverSettings.StartingMana.Value + (serverSettings.ManaBoostPerMythicality.Value * players.LocalPlayer.Attributes.Mythicality.Value)
end

local rankCap = game:GetService("ReplicatedStorage").ServerSettings.RankCap
local gold = players.LocalPlayer:WaitForChild("Stats"):WaitForChild("Gold")
local xp = players.LocalPlayer:WaitForChild("Stats"):WaitForChild("XP")
local rank = players.LocalPlayer:WaitForChild("Stats"):WaitForChild("Rank")
local currentArmor = players.LocalPlayer:WaitForChild("Stats"):WaitForChild("CurrentArmor")
local prevGold = gold.Value
local prevXP = xp.Value
local prevRank = rank.Value
gold.Changed:Connect(function()
	if gold.Value > prevGold then
		GoldIncreaseEffect(math.floor(gold.Value - prevGold))
	end
	prevGold = gold.Value
end)
xp.Changed:Connect(function()
	if xp.Value > prevXP then
		XPIncreaseEffect(math.floor(xp.Value - prevXP))
	end
	prevXP = xp.Value
end)
rank.Changed:Connect(function()
	if rank.Value > prevRank then
		RankUpEffect()
	end
	prevRank = rank.Value
end)
UpdateDefense()
currentArmor.Changed:Connect(UpdateDefense)
