local Q=game:GetService("\080\108\097\121\101\114\115")local h=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local N=game:GetService("\083\116\097\114\116\101\114\071\117\105")local H=require((h:WaitForChild("\080\114\111\106\101\099\116")):WaitForChild("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101"))local O=H:GetResource("\085\073\046\065\115\112\101\099\116\082\097\116\105\111\083\119\105\116\099\104\101\114")local U=(H:GetResource("\083\116\097\116\101\046\080\108\097\121\101\114\068\097\116\097")).GetPlayerData(Q.LocalPlayer)local T=H:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\083\116\097\114\116\068\117\110\103\101\111\110")local J=H:GetResource("\071\097\109\101\082\101\112\108\105\099\097\116\105\111\110\046\068\117\110\103\101\111\110\082\101\112\108\105\099\097\116\105\111\110\046\069\110\100\068\117\110\103\101\111\110")local t=script.Parent:WaitForChild("\071\117\105\079\112\101\110\083\116\097\116\101\115")local P=t:WaitForChild("\083\116\111\114\101")local b=t:WaitForChild("\077\097\112")local B=Instance.new("\083\099\114\101\101\110\071\117\105")B.Name="\083\105\100\101\084\111\111\108\115\086\105\101\119"B.Parent=script.Parent local L=Instance.new("\073\109\097\103\101\076\097\098\101\108")L.BackgroundTransparency=1 L.Position=UDim2.new(1,0,.5,0)L.Size=UDim2.new(.11771844660194,0,.25,0)L.AnchorPoint=Vector2.new(.95,.6)L.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\057\050\057\052\050\053"L.Parent=B O.new(B,1,function()L.SizeConstraint=Enum.SizeConstraint.RelativeYY end,function()L.SizeConstraint=Enum.SizeConstraint.RelativeXX end)local K=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")K.BackgroundTransparency=1 K.AnchorPoint=Vector2.new(.5,.5)K.Size=UDim2.new(.64948453608247,0,.30582524271845,0)K.Position=UDim2.new(.5,0,.31,0)K.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\057\050\057\051\053\051"K.Parent=L local W=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")W.BackgroundTransparency=1 W.AnchorPoint=Vector2.new(.5,.5)W.Size=UDim2.new(.75257731958763,0,.35436893203883,0)W.Position=UDim2.new(.5,0,.7,0)W.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\051\057\048\052\056\055"W.Parent=L local g=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")g.BackgroundTransparency=1 g.AnchorPoint=Vector2.new(.5,.5)g.Size=UDim2.new(.65979381443299,0,.31067961165049)g.Position=UDim2.new(.5,0,1.09,0)g.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\049\051\052\056\053\051\057"g.Parent=L local function u()local h=Q.LocalPlayer.Character if h then if h:FindFirstChild("\072\097\108\108\111\067\121\099\108\101")then K.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\057\050\057\051\057\057"else K.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\050\057\050\057\051\053\051"end if h:FindFirstChild("\084\114\105\099\107\079\114\084\114\101\097\116\066\097\103")then W.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\051\056\057\054\056\051"else W.Image="\114\098\120\097\115\115\101\116\105\100\058\047\047\049\051\051\051\057\048\052\056\055"end end end local function q()P.Value=true end local function I()b.Value=true end local function r(h)if not(U:GetValue("\084\111\111\108\115\079\119\110\101\100"))[h]then q()return end local N=Q.LocalPlayer:WaitForChild("\066\097\099\107\112\097\099\107")local H=Q.LocalPlayer.Character if H then local Q=H:FindFirstChild("\072\117\109\097\110\111\105\100")if Q then local H=N:FindFirstChild(h)if H then Q:EquipTool(H)else Q:UnequipTools()end u()end end end N:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)local p=true K.MouseButton1Down:Connect(function()if p and L.Visible then p=false r("\072\097\108\108\111\067\121\099\108\101")wait()p=true end end)W.MouseButton1Down:Connect(function()if p and L.Visible then p=false r("\084\114\105\099\107\079\114\084\114\101\097\116\066\097\103")wait()p=true end end)g.MouseButton1Down:Connect(function()if p and L.Visible then p=false if U:GetValue("\087\097\114\112\080\117\114\099\104\097\115\101\100")then I()else q()end wait()p=true end end)Q.LocalPlayer.CharacterAdded:Connect(u)T.OnClientEvent:Connect(function()L.Visible=false local h=Q.LocalPlayer.Character if h then local Q=h:FindFirstChild("\072\117\109\097\110\111\105\100")if Q then Q:UnequipTools()u()end end end)J.OnClientEvent:Connect(function()L.Visible=true end)
--[[
TheNexusAvenger

Displays the navigation tools on the side of the screen.
--]]

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local ReplicatedStorageProject = require(ReplicatedStorage:WaitForChild("Project"):WaitForChild("ReplicatedStorage"))

local AspectRatioSwitcher = ReplicatedStorageProject:GetResource("UI.AspectRatioSwitcher")
local PlayerData = ReplicatedStorageProject:GetResource("State.PlayerData").GetPlayerData(Players.LocalPlayer)
local StartDungeon = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.StartDungeon")
local EndDungeon = ReplicatedStorageProject:GetResource("GameReplication.DungeonReplication.EndDungeon")
local GuiOpenStates = script.Parent:WaitForChild("GuiOpenStates")
local StoreOpenState = GuiOpenStates:WaitForChild("Store")
local MapOpenState = GuiOpenStates:WaitForChild("Map")



--Create the ScreenGui.
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "SideToolsView"
ScreenGui.Parent = script.Parent

--Create the container.
local Background = Instance.new("ImageLabel")
Background.BackgroundTransparency = 1
Background.Position = UDim2.new(1,0,0.5,0)
Background.Size = UDim2.new(0.25 * (97/206),0,0.25,0)
Background.AnchorPoint = Vector2.new(0.95,0.6)
Background.Image = "rbxassetid://132929425"
Background.Parent = ScreenGui

AspectRatioSwitcher.new(ScreenGui,1,function()
    Background.SizeConstraint = Enum.SizeConstraint.RelativeYY
end,function()
    Background.SizeConstraint = Enum.SizeConstraint.RelativeXX
end)

local CycleButton = Instance.new("ImageButton")
CycleButton.BackgroundTransparency = 1
CycleButton.AnchorPoint = Vector2.new(0.5,0.5)
CycleButton.Size = UDim2.new(63/97,0,63/206,0)
CycleButton.Position = UDim2.new(0.5,0,0.31,0)
CycleButton.Image = "rbxassetid://132929353"
CycleButton.Parent = Background

local BagButton = Instance.new("ImageButton")
BagButton.BackgroundTransparency = 1
BagButton.AnchorPoint = Vector2.new(0.5,0.5)
BagButton.Size = UDim2.new(73/97,0,73/206,0)
BagButton.Position = UDim2.new(0.5,0,0.7,0)
BagButton.Image = "rbxassetid://133390487"
BagButton.Parent = Background

local TeleportButton = Instance.new("ImageButton")
TeleportButton.BackgroundTransparency = 1
TeleportButton.AnchorPoint = Vector2.new(0.5,0.5)
TeleportButton.Size = UDim2.new(64/97,0,64/206)
TeleportButton.Position = UDim2.new(0.5,0,1.09,0)
TeleportButton.Image = "rbxassetid://131348539"
TeleportButton.Parent = Background



--[[
Updates the buttons.
--]]
local function UpdateButtons()
    local Character = Players.LocalPlayer.Character
    if Character then
        if Character:FindFirstChild("HalloCycle") then
            CycleButton.Image = "rbxassetid://132929399"
        else
            CycleButton.Image = "rbxassetid://132929353"
        end
        if Character:FindFirstChild("TrickOrTreatBag") then
            BagButton.Image = "rbxassetid://133389683"
        else
            BagButton.Image = "rbxassetid://133390487"
        end
    end
end

--[[
Shows the stroe.
--]]
local function ShowStore()
    StoreOpenState.Value = true
end

--[[
Shows the map.
--]]
local function ShowMap()
    MapOpenState.Value = true
end

--[[
Toggles a tool being equipped.
--]]
local function ToggleEquipped(ToolName)
    --Show the store and return if the tool hasn't been purchased.
    if not PlayerData:GetValue("ToolsOwned")[ToolName] then
        ShowStore()
        return
    end

    --Toggle the tool.
    local Backpack = Players.LocalPlayer:WaitForChild("Backpack")
    local Character = Players.LocalPlayer.Character
    if Character then
        local Humanoid = Character:FindFirstChild("Humanoid")
        if Humanoid then
            local Tool = Backpack:FindFirstChild(ToolName)
            if Tool then
                Humanoid:EquipTool(Tool)
            else
                Humanoid:UnequipTools()
            end
            UpdateButtons()
        end
    end
end



--Connect the buttons.
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)
local DB = true
CycleButton.MouseButton1Down:Connect(function()
    if DB and Background.Visible then
        DB = false
        ToggleEquipped("HalloCycle")
        wait()
        DB = true
    end
end)
BagButton.MouseButton1Down:Connect(function()
    if DB and Background.Visible then
        DB = false
        ToggleEquipped("TrickOrTreatBag")
        wait()
        DB = true
    end
end)
TeleportButton.MouseButton1Down:Connect(function()
    if DB and Background.Visible then
        DB = false
        if PlayerData:GetValue("WarpPurchased") then
            ShowMap()
        else
            ShowStore()
        end
        wait()
        DB = true
    end
end)
Players.LocalPlayer.CharacterAdded:Connect(UpdateButtons)

--Connect showing and hiding the UI.
StartDungeon.OnClientEvent:Connect(function()
    Background.Visible = false
    local Character = Players.LocalPlayer.Character
    if Character then
        local Humanoid = Character:FindFirstChild("Humanoid")
        if Humanoid then
            Humanoid:UnequipTools()
            UpdateButtons()
        end
    end
end)

EndDungeon.OnClientEvent:Connect(function()
    Background.Visible = true
end)