function ConvertKey(U)if U==string.char(8)then return"\066\075\083\080\067\069"elseif U==string.char(9)then return"\084\065\066"elseif U==string.char(13)then return"\069\078\084\069\082"elseif U==string.char(17)then return"\085\080"elseif U==string.char(18)then return"\068\079\087\078"elseif U==string.char(19)then return"\082\073\071\072\084"elseif U==string.char(20)then return"\076\069\070\084"elseif U==string.char(22)then return"\072\079\077\069"elseif U==string.char(23)then return"\069\078\068"elseif U==string.char(27)then return"\070\050"elseif U==string.char(29)then return"\070\052"elseif U==string.char(30)then return"\070\053"elseif U==string.char(32)or U==" "then return"\070\055"elseif U==string.char(33)or U=="\033"then return"\070\056"elseif U==string.char(34)or U=="\""then return"\070\057"elseif U==string.char(35)or U=="\035"then return"\070\049\048"elseif U==string.char(37)or U=="\037"then return"\070\049\050"elseif U==string.char(47)or U=="\047"then return"\082-\083\072\073\070\084"elseif U==string.char(48)or U=="\048"then return"\076-\083\072\073\070\084"elseif U==string.char(49)or U=="\049"then return"\082-\067\084\082\076"elseif U==string.char(50)or U=="\050"then return"\076-\067\084\082\076"elseif U==string.char(51)or U=="\051"then return"\082-\065\076\084"elseif U==string.char(52)or U=="\052"then return"\076-\065\076\084"else return string.upper(U)end end function CreateControlFrame(U,L,H)local q=Instance.new("\070\114\097\109\101")q.BackgroundTransparency=H%2==1 and.7 or 1 q.BorderSizePixel=0 q.Name="\067"..H q.Position=UDim2.new(0,0,0,H*20)q.Size=UDim2.new(1,0,0,20)local u=Instance.new("\084\101\120\116\076\097\098\101\108")u.BackgroundTransparency=1 u.Name="\075\101\121"u.Size=UDim2.new(0,45,1,0)u.Font=Enum.Font.ArialBold u.FontSize=Enum.FontSize.Size14 u.Text=U u.TextColor3=Color3.new(1,1,1)u.TextScaled=string.len(U)>5 u.TextWrapped=string.len(U)>5 u.Parent=q local h=Instance.new("\084\101\120\116\076\097\098\101\108")h.BackgroundTransparency=1 h.Name="\068\101\115\099"h.Position=UDim2.new(0,50,0,0)h.Size=UDim2.new(1,-50,1,0)h.Font=Enum.Font.ArialBold h.FontSize=Enum.FontSize.Size14 h.Text="- "..L h.TextColor3=Color3.new(1,1,1)h.TextXAlignment=Enum.TextXAlignment.Left h.Parent=q end function SetUpGui()local U=Gui_Clone:WaitForChild("\072\085\068")local L=Gui_Clone:WaitForChild("\083\099\111\112\101")local H=1 if S.CanChangeStance then local U=S.DolphinDive and" \047 \068\105\118\101"or""CreateControlFrame(ConvertKey(S.LowerStanceKey),"\076\111\119\101\114 \083\116\097\110\099\101"..U,H)H=H+1 CreateControlFrame(ConvertKey(S.RaiseStanceKey),"\082\097\105\115\101 \083\116\097\110\099\101",H)H=H+1 end CreateControlFrame(ConvertKey(S.ReloadKey),"\082\101\108\111\097\100",H)H=H+1 if S.CanKnife then CreateControlFrame(ConvertKey(S.KnifeKey),"\075\110\105\102\101",H)H=H+1 end CreateControlFrame(ConvertKey(S.SprintKey),"\083\112\114\105\110\116",H)H=H+1 if S.GuiScope then(L:WaitForChild("\073\109\103")).Image=S.GuiId;(L:WaitForChild("\083\116\101\097\100\121")).Text="\072\111\108\100 "..(ConvertKey(S.ScopeSteadyKey).." \116\111 \083\116\101\097\100\121")end;(((U:WaitForChild("\071\114\101\110\097\100\101\115")):WaitForChild("\076\101\116\104\097\108\115")):WaitForChild("\073\099\111\110")).Image=LethalIcons[S.LethalGrenadeType];(((U:WaitForChild("\071\114\101\110\097\100\101\115")):WaitForChild("\084\097\099\116\105\099\097\108\115")):WaitForChild("\073\099\111\110")).Image=TacticalIcons[S.TacticalGrenadeType]end
--------------------[ GUI SETUP FUNCTION ]--------------------------------------------

function ConvertKey(Key)
	if Key == string.char(8) then
		return "BKSPCE"
	elseif Key == string.char(9) then
		return "TAB"
	elseif Key == string.char(13) then
		return "ENTER"
	elseif Key == string.char(17) then
		return "UP"
	elseif Key == string.char(18) then
		return "DOWN"
	elseif Key == string.char(19) then
		return "RIGHT"
	elseif Key == string.char(20) then
		return "LEFT"
	elseif Key == string.char(22) then
		return "HOME"
	elseif Key == string.char(23) then
		return "END"
	elseif Key == string.char(27) then
		return "F2"
	elseif Key == string.char(29) then
		return "F4"
	elseif Key == string.char(30) then
		return "F5"
	elseif Key == string.char(32) or Key == " " then
		return "F7"
	elseif Key == string.char(33) or Key == "!" then
		return "F8"
	elseif Key == string.char(34) or Key == '"' then
		return "F9"
	elseif Key == string.char(35) or Key == "#" then
		return "F10"
	elseif Key == string.char(37) or Key == "%" then
		return "F12"
	elseif Key == string.char(47) or Key == "/" then
		return "R-SHIFT"
	elseif Key == string.char(48) or Key == "0" then
		return "L-SHIFT"
	elseif Key == string.char(49) or Key == "1" then
		return "R-CTRL"
	elseif Key == string.char(50) or Key == "2" then
		return "L-CTRL"
	elseif Key == string.char(51) or Key == "3" then
		return "R-ALT"
	elseif Key == string.char(52) or Key == "4" then
		return "L-ALT"
	else
		return string.upper(Key)
	end
end

function CreateControlFrame(Key, Desc, Num)
	local C = Instance.new("Frame")
	C.BackgroundTransparency = ((Num % 2) == 1 and 0.7 or 1)
	C.BorderSizePixel = 0
	C.Name = "C" .. Num
	C.Position = UDim2.new(0, 0, 0, Num * 20)
	C.Size = UDim2.new(1, 0, 0, 20)

	local K = Instance.new("TextLabel")
	K.BackgroundTransparency = 1
	K.Name = "Key"
	K.Size = UDim2.new(0, 45, 1, 0)
	K.Font = Enum.Font.ArialBold
	K.FontSize = Enum.FontSize.Size14
	K.Text = Key
	K.TextColor3 = Color3.new(1, 1, 1)
	K.TextScaled = (string.len(Key) > 5)
	K.TextWrapped = (string.len(Key) > 5)
	K.Parent = C

	local D = Instance.new("TextLabel")
	D.BackgroundTransparency = 1
	D.Name = "Desc"
	D.Position = UDim2.new(0, 50, 0, 0)
	D.Size = UDim2.new(1, -50, 1, 0)
	D.Font = Enum.Font.ArialBold
	D.FontSize = Enum.FontSize.Size14
	D.Text = "- " .. Desc
	D.TextColor3 = Color3.new(1, 1, 1)
	D.TextXAlignment = Enum.TextXAlignment.Left
	D.Parent = C
end

function SetUpGui()
	local HUD = Gui_Clone:WaitForChild("HUD")
	local Scope = Gui_Clone:WaitForChild("Scope")
	local CurrentNum = 1

	if S.CanChangeStance then
		local Dive = (S.DolphinDive and " / Dive" or "")
		CreateControlFrame(ConvertKey(S.LowerStanceKey), "Lower Stance" .. Dive, CurrentNum)
		CurrentNum = CurrentNum + 1

		CreateControlFrame(ConvertKey(S.RaiseStanceKey), "Raise Stance", CurrentNum)
		CurrentNum = CurrentNum + 1
	end

	CreateControlFrame(ConvertKey(S.ReloadKey), "Reload", CurrentNum)
	CurrentNum = CurrentNum + 1

	if S.CanKnife then
		CreateControlFrame(ConvertKey(S.KnifeKey), "Knife", CurrentNum)
		CurrentNum = CurrentNum + 1
	end
	CreateControlFrame(ConvertKey(S.SprintKey), "Sprint", CurrentNum)
	CurrentNum = CurrentNum + 1

	if S.GuiScope then
		Scope:WaitForChild("Img").Image = S.GuiId
		Scope:WaitForChild("Steady").Text = "Hold " .. ConvertKey(S.ScopeSteadyKey) .. " to Steady"
	end

	HUD:WaitForChild("Grenades"):WaitForChild("Lethals"):WaitForChild("Icon").Image = LethalIcons[S.LethalGrenadeType]
	HUD:WaitForChild("Grenades"):WaitForChild("Tacticals"):WaitForChild("Icon").Image =
		TacticalIcons[S.TacticalGrenadeType]
end
