FE hat snake script DECOMPILED BY ME
Key RequiredUniversal

FE hat snake script DECOMPILED BY ME

Universal Scriptgorfersgorfers 2.1K views 324 executesUpdated Nov 29, 2025
5.0/ 5(1 votes)
10100% Positive
Lua Script•521 lines (20522 chars)
-- filename: 
-- version: lua51
-- line: [0, 0] id: 0
  local horizontalPlaneMask = Vector3.new(1, 0, 1)
  local verticalOffset = Vector3.new(0, 25.01, 0)
  local function calculateVelocity(inputVelocity)
    -- line: [0, 0] id: 23
    local horizontalVelocity = inputVelocity * horizontalPlaneMask
    local speed = horizontalVelocity.Magnitude
    if speed > 0.1 then
      horizontalVelocity = 100 / speed * horizontalVelocity
    end
    return verticalOffset + horizontalVelocity
  end
  local UserInputService = game:GetService("UserInputService")
  local Workspace = game:GetService("Workspace")
  local Players = game:GetService("Players")
  local RunService = game:GetService("RunService")
  local UserInputService = game:GetService("UserInputService")
  local GuiService = game:GetService("GuiService")
  local StarterGui = game:GetService("StarterGui")
  local PostSimulation = RunService.PostSimulation
  local PreRender = RunService.PreRender
  local Heartbeat = RunService.Heartbeat
  local LocalPlayer = Players.LocalPlayer
  local Mouse = LocalPlayer:GetMouse()
  local random = math.random
  local Instance_new = Instance.new
  local Cframe_new = CFrame.new
  local Vector3_New = Vector3.new
  local TouchEnabled = UserInputService.TouchEnabled
  local IsFlagFalse = false
  local IsFlagTrue = true
  local MiscValue = nil
  local Threshold = 0.9
  local SomeNilValue = nil
  local character = nil
  local someTable = {}
  local someCounter = 0
  local anotherTable = {}
  local YetAnotherTable = {}
  local playerCharacter = LocalPlayer.Character
  if playerCharacter then
    playerCharacter = LocalPlayer.Character:GetPivot().Position or nil
  else
  end
  local guiElements = {}
  local isForwardPressed = false
  local isLeftPressed = false
  local isBackPressed = false
  local isRightPressed = false
  local walkspeed = 14
  local jumppower = 16
  local gravity = -64
  local jumpHeight = 3
  local groundY = 0
  local groundCheckCounter = 0
  local jumpThreshold = 5
  local groundOffset = 0.25
  local minFallY = -20
  local groundClampY = -19
  local mouseSensitivity = Vector2.new(2, 1.5)
  local zoomSensitivity = 2
  local zoomMin = 0
  local zoomMax = 0
  local zoomCurrent = 0
  local isRightMouseDown = false
  local touchInput = nil
  local rightMouseStartPos = nil
  local camera = nil
  local viewAngles = Vector2.new(0, 0)
  local zoomDistance = 16
  local cameraObject = nil
  local isTouching = false
  local isJumping = false
  if LocalPlayer.Character then
    character = LocalPlayer.Character
  else
    print("Character not found")
    return 
  end
  local resetEvent = Instance.new("BindableEvent", LocalPlayer)
  resetEvent.Event:Connect(function()
    -- line: [0, 0] id: 6
    for i, v in pairs(someTable) do
      v:Disconnect()
    end
    if guiElements.ScreenGui_1 then
      guiElements.ScreenGui_1:Destroy()
    end
    if fhatholder then
      fhatholder:Destroy()
    end
    if replicatesignal and IsFlagTrue then
      replicatesignal(LocalPlayer.ConnectDiedSignalBackend)
    end
    if MiscValue then
      MiscValue.CameraType = Enum.CameraType.Custom
    end
    resetEvent:Destroy()
  end)
  StarterGui:SetCore("ResetButtonCallback", resetEvent)
  local partFolder = Instance_new("Folder", Workspace)
  partFolder.Name = random(1, 34)
  local mainPart = Instance_new("Part", partFolder)
  mainPart.Size = Vector3_New(1, 1, 1)
  mainPart.Transparency = 1
  mainPart.Anchored = true
  mainPart.Position = character:FindFirstChild("HumanoidRootPart").Position
  mainPart.CanCollide = false
  local verticalVelocity = 0
  local currentPosition = mainPart.Position
  rayParams = RaycastParams.new()
  rayParams.FilterType = Enum.RaycastFilterType.Blacklist
  rayParams.FilterDescendantsInstances = {
    character,
    fhatfolder
  }
  rayParams.CollisionGroup = "Default"
  mainPart.Position = currentPosition
  local function updateCameraView()
    -- line: [0, 0] id: 19
    if not mainPart then
      return 
    end
    local basePos = mainPart.CFrame.Position + Vector3_New(0, -1, 0)
    MiscValue.CFrame = CFrame.lookAt(basePos - (CFrame.Angles(0, math.rad(viewAngles.X), 0) * CFrame.Angles(math.rad(viewAngles.Y), 0, 0)).LookVector * zoomDistance, basePos)
  end
  local function setScriptableCamera()
    -- line: [0, 0] id: 17
    if MiscValue.CameraType ~= Enum.CameraType.Scriptable then
      MiscValue.CameraType = Enum.CameraType.Scriptable
    end
  end
  local function isTypingOrTenFoot()
    -- line: [0, 0] id: 20
    -- notice: unreachable block#2
    local focusedBox = UserInputService:GetFocusedTextBox()
    if focusedBox == nil then
      focusedBox = GuiService:IsTenFootInterface()
    else
      focusedBox = true
    end
    return focusedBox
  end
  UserInputService.InputBegan:Connect(function(inputObject)
    -- line: [0, 0] id: 33
    if isTypingOrTenFoot() then
      return 
    end
    if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
      isTouching = true
      cameraObject = inputObject.Position
    end
  end)
  UserInputService.InputChanged:Connect(function(inputObject)
    -- line: [0, 0] id: 24
    if isTypingOrTenFoot() then
      return 
    end
    if isTouching and inputObject.UserInputType == Enum.UserInputType.MouseMovement then
      local Delta = inputObject.Position - cameraObject
      viewAngles = viewAngles + Vector2.new(-Delta.X, -Delta.Y) * mouseSensitivity
      viewAngles = Vector2.new(viewAngles.X % 360, math.clamp(viewAngles.Y, -80, 80))
      cameraObject = inputObject.Position
    end
  end)
  UserInputService.InputEnded:Connect(function(inputObject)
    -- line: [0, 0] id: 18
    if inputObject.UserInputType == Enum.UserInputType.MouseButton2 then
      isTouching = false
    end
  end)
  UserInputService.InputChanged:Connect(function(inputObject)
    -- line: [0, 0] id: 2
    if isTypingOrTenFoot() then
      return 
    end
    if inputObject.UserInputType == Enum.UserInputType.MouseWheel then
      zoomDistance = math.clamp(zoomDistance - inputObject.Position.Z * zoomSensitivity, zoomMin, zoomMax)
    end
  end)
  UserInputService.TouchStarted:Connect(function(touchInputObject, gameProcessed)
    -- line: [0, 0] id: 28
    if gameProcessed or isTypingOrTenFoot() or touchInputObject.UserInputState ~= Enum.UserInputState.Begin then
      return 
    end
    if touchInputObject.UserInputType == Enum.UserInputType.Touch then
      touchInput = touchInputObject
    end
  end)
  UserInputService.TouchMoved:Connect(function(touchInputObject, gameProcessed)
    -- line: [0, 0] id: 21
    if gameProcessed or isTypingOrTenFoot() then
      return 
    end
    if touchInputObject == touchInput and touchInputObject.UserInputType == Enum.UserInputType.Touch then
      local delta = touchInputObject.Delta
      viewAngles = viewAngles + Vector2.new(-delta.X, -delta.Y) * mouseSensitivity
      viewAngles = Vector2.new(viewAngles.X % 360, math.clamp(viewAngles.Y, -80, 80))
    end
  end)
  UserInputService.TouchEnded:Connect(function(touchInputObject)
    -- line: [0, 0] id: 27
    if touchInputObject == touchInput then
      touchInput = nil
    end
  end)
  local function initializeCamera()
    -- line: [0, 0] id: 29
    local currentCamera = Workspace.CurrentCamera
    if currentCamera then
      MiscValue = currentCamera
      setScriptableCamera()
      table.insert(someTable, MiscValue:GetPropertyChangedSignal("CameraType"):Connect(setScriptableCamera))
      table.insert(someTable, RunService.RenderStepped:Connect(updateCameraView))
    end
  end
  local function handleAccessory(hatAccessory)
    -- line: [0, 0] id: 25
    if hatAccessory:IsA("Accessory") then
      local hatPart = hatAccessory.Handle or hatAccessory:FindFirstChildOfClass("BasePart")
      if hatAccessory and hatPart then
        local hatIndex = someCounter
        hatPart.AssemblyLinearVelocity = calculateVelocity(hatPart.AssemblyLinearVelocity)
        table.insert(someTable, Heartbeat:Connect(function()
          -- line: [0, 0] id: 26
          if not hatAccessory and not hatPart then
            return connection:Disconnect()
          end
          if hatPart.ReceiveAge == 0 then
            hatPart.AssemblyLinearVelocity = calculateVelocity(hatPart.AssemblyLinearVelocity)
            hatPart.AssemblyAngularVelocity = Vector3_New(0, 0, 0)
            if YetAnotherTable[#YetAnotherTable - hatIndex] then
              hatPart.CFrame = YetAnotherTable[#YetAnotherTable - hatIndex].CFrame + Vector3_New(0, 0, math.sin(os.clock() * 30) * 0.05)
            else
              hatPart.CFrame = mainPart.CFrame + Vector3_New(0, 0, math.sin(os.clock() * 30) * 0.05)
            end
          end
        end))
        -- close: hatIndex
      end
      -- close: hatPart
    end
  end
  local function onCharacterAdded(newCharacter)
    -- line: [0, 0] id: 3
    character = newCharacter
    if character then
      someCounter = 0
      anotherTable = {}
      local rootPart = character:WaitForChild("HumanoidRootPart", 5)
      local isTrackingCharacter = character
      local targetCFrame = nil	-- notice: implicit variable refs by block#[17]
      if isTrackingCharacter and rootPart then
        isTrackingCharacter = true
        rootPart.AssemblyAngularVelocity = Vector3_New(0, 0, 0)
        rootPart.AssemblyLinearVelocity = Vector3_New(0, 0, 0)
        targetCFrame = mainPart.CFrame - Vector3_New(0, 30, 0)
        task.spawn(function()
          -- line: [0, 0] id: 5
          while isTrackingCharacter do
            rootPart.AssemblyAngularVelocity = Vector3_New(0, 0, 0)
            rootPart.AssemblyLinearVelocity = Vector3_New(0, 0, 0)
            rootPart.CFrame = targetCFrame
            task.wait()
          end
        end)
        IsFlagFalse = true
        if replicatesignal and IsFlagTrue then
          replicatesignal(LocalPlayer.ConnectDiedSignalBackend)
          task.wait(Players.RespawnTime + 0.1)
          replicatesignal(character:FindFirstChildOfClass("Humanoid").ServerBreakJoints)
        else
          task.wait(1.251)
          character:FindFirstChildOfClass("Humanoid"):ChangeState(15)
        end
        for i, v in pairs(character:GetChildren()) do
          if v:IsA("Accessory") then
            table.insert(anotherTable, v)
          end
        end
        for i, v in pairs(anotherTable) do
          someCounter = i - 1
          handleAccessory(v)
        end
        isTrackingCharacter = false
        IsFlagFalse = false
        -- close: isTrackingCharacter
      end
      isTrackingCharacter = replicatesignal
      if isTrackingCharacter then
        isTrackingCharacter = IsFlagTrue
        if isTrackingCharacter then
          isTrackingCharacter = nil
          targetCFrame = newCharacter.ChildRemoved
          targetCFrame = targetCFrame:Connect(function(r0_4)
            -- line: [0, 0] id: 4
            if r0_4:IsA("Accessory") then
              isTrackingCharacter:Disconnect()
              replicatesignal(LocalPlayer.ConnectDiedSignalBackend)
            end
          end)
          isTrackingCharacter = targetCFrame
          -- close: isTrackingCharacter
        end
      end
      -- close: rootPart
    end
  end
  task.spawn(function()
    -- line: [0, 0] id: 30
    table.insert(someTable, PreRender:Connect(function()
      -- line: [0, 0] id: 31
      LocalPlayer.SimulationRadius = 473738
    end))
    table.insert(someTable, PostSimulation:Connect(function()
      -- line: [0, 0] id: 32
      mainPart.CFrame = Cframe_new(mainPart.Position)
      if (playerCharacter - mainPart.Position).magnitude > 1 then
        local newPart = Instance.new("Part", partFolder)
        newPart.Anchored = true
        newPart.Size = Vector3.new(1, 1, 1)
        newPart.CFrame = CFrame.lookAt(playerCharacter, mainPart.Position)
        newPart.CanCollide = false
        newPart.Transparency = 1
        playerCharacter = mainPart.Position
        table.insert(YetAnotherTable, newPart)
      end
      if YetAnotherTable[#YetAnotherTable - 10] then
        YetAnotherTable[#YetAnotherTable - 10]:Destroy()
        table.remove(YetAnotherTable, #YetAnotherTable - 10)
      end
    end))
  end)
  table.insert(someTable, game:GetService("RunService").Heartbeat:Connect(function(dt)
    -- line: [0, 0] id: 22
    local raycastResult = workspace:Raycast(mainPart.Position, Vector3.new(0, -6, 0), rayParams)
    local isOnGround = raycastResult ~= nil
    if not isOnGround then
      if math.abs(mainPart.Position.Y - groundY) < 0.02 then
        groundCheckCounter = groundCheckCounter + 1
        if jumpThreshold <= groundCheckCounter then
          isOnGround = true
        end
      else
        groundCheckCounter = 0
      end
    end
    groundY = mainPart.Position.Y
    if not raycastResult and mainPart.Position.Y <= minFallY then
      raycastResult = {
        Position = Vector3.new(mainPart.Position.X, groundClampY, MainPart.Position.Z),
      }
      isOnGround = true
    end
    local lookVector = MiscValue.CFrame.LookVector
    local rightVector = MiscValue.CFrame.RightVector
    local moveForwardVector = Vector3.new(lookVector.X, 0, lookVector.Z).Unit
    local moveRightVector = Vector3.new(rightVector.X, 0, rightVector.Z).Unit
    local movementDirection = Vector3.zero
    if UserInputService:IsKeyDown(Enum.KeyCode.W) or isForwardPressed then
      movementDirection = movementDirection + moveForwardVector
    end
    if UserInputService:IsKeyDown(Enum.KeyCode.S) or isBackPressed then
      movementDirection = movementDirection - moveForwardVector
    end
    if UserInputService:IsKeyDown(Enum.KeyCode.D) or isRightPressed then
      movementDirection = movementDirection + moveRightVector
    end
    if UserInputService:IsKeyDown(Enum.KeyCode.A) or isLeftPressed then
      movementDirection = movementDirection - moveRightVector
    end
    if movementDirection.Magnitude > 0 then
      movementDirection = movementDirection.Unit
    end
    local speed = walkspeed
    if not isOnGround then
      speed = speed * 0.98
    end
    if UserInputService:IsKeyDown(Enum.KeyCode.Space) and isOnGround then
      verticalVelocity = jumppower
      isOnGround = false
      groundCheckCounter = 0
    end
    verticalVelocity = verticalVelocity + gravity * dt
    currentPosition = currentPosition + Vector3.new(0, verticalVelocity * dt, 0)
    if isOnGround and raycastResult and verticalVelocity <= 0 then
      local minY = raycastResult.Position.Y + groundOffset
      if currentPosition.Y < minY then
        currentPosition = Vector3.new(currentPosition.X, minY, currentPosition.Z)
        verticalVelocity = 0
      end
    end
    currentPosition = currentPosition + movementDirection * speed * dt
    mainPart.Position = currentPosition
  end))
  task.spawn(function()
    -- line: [0, 0] id: 7
    if TouchEnabled then
      guiElements.ScreenGui_1 = Instance.new("ScreenGui", game:GetService("Players").LocalPlayer:WaitForChild("PlayerGui"))
      guiElements.ScreenGui_1.SafeAreaCompatibility = Enum.SafeAreaCompatibility.None
      guiElements.ScreenGui_1.IgnoreGuiInset = true
      guiElements.ScreenGui_1.ScreenInsets = Enum.ScreenInsets.None
      guiElements.ScreenGui_1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
      guiElements.ScreenGui_1.ResetOnSpawn = false
      guiElements.Frame_2 = Instance.new("Frame", guiElements.ScreenGui_1)
      guiElements.Frame_2.BorderSizePixel = 0
      guiElements.Frame_2.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.Frame_2.Size = UDim2.new(1, 0, 1, 0)
      guiElements.Frame_2.BackgroundTransparency = 1
      guiElements.W_3 = Instance.new("TextButton", guiElements.Frame_2)
      guiElements.W_3.TextWrapped = true
      guiElements.W_3.BorderSizePixel = 0
      guiElements.W_3.TextScaled = true
      guiElements.W_3.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.W_3.BackgroundTransparency = 0.5
      guiElements.W_3.Size = UDim2.new(0.05564, 0, 0.1078, 0)
      guiElements.W_3.Text = "W"
      guiElements.W_3.Name = "W"
      guiElements.W_3.Position = UDim2.new(0.11274, 0, 0.49929, 0)
      guiElements.UICorner_4 = Instance.new("UICorner", guiElements.W_3)
      guiElements.UICorner_4.CornerRadius = UDim.new(0.2, 0)
      guiElements.A_5 = Instance.new("TextButton", guiElements.Frame_2)
      guiElements.A_5.TextWrapped = true
      guiElements.A_5.BorderSizePixel = 0
      guiElements.A_5.TextScaled = true
      guiElements.A_5.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.A_5.BackgroundTransparency = 0.5
      guiElements.A_5.Size = UDim2.new(0.05564, 0, 0.1078, 0)
      guiElements.A_5.Text = "A"
      guiElements.A_5.Name = "A"
      guiElements.A_5.Position = UDim2.new(0.04246, 0, 0.63262, 0)
      guiElements.UICorner_6 = Instance.new("UICorner", guiElements.A_5)
      guiElements.UICorner_6.CornerRadius = UDim.new(0.2, 0)
      guiElements.D_7 = Instance.new("TextButton", guiElements.Frame_2)
      guiElements.D_7.TextWrapped = true
      guiElements.D_7.BorderSizePixel = 0
      guiElements.D_7.TextScaled = true
      guiElements.D_7.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.D_7.BackgroundTransparency = 0.5
      guiElements.D_7.Size = UDim2.new(0.05564, 0, 0.1078, 0)
      guiElements.D_7.Text = "D"
      guiElements.D_7.Name = "D"
      guiElements.D_7.Position = UDim2.new(0.18009, 0, 0.62979, 0)
      guiElements.UICorner_8 = Instance.new("UICorner", guiElements.D_7)
      guiElements.UICorner_8.CornerRadius = UDim.new(0.2, 0)
      guiElements.S_9 = Instance.new("TextButton", guiElements.Frame_2)
      guiElements.S_9.TextWrapped = true
      guiElements.S_9.BorderSizePixel = 0
      guiElements.S_9.TextScaled = true
      guiElements.S_9.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.S_9.BackgroundTransparency = 0.5
      guiElements.S_9.Size = UDim2.new(0.05564, 0, 0.1078, 0)
      guiElements.S_9.Text = "S"
      guiElements.S_9.Name = "S"
      guiElements.S_9.Position = UDim2.new(0.10981, 0, 0.76596, 0)
      guiElements.UICorner_a = Instance.new("UICorner", guiElements.S_9)
      guiElements.UICorner_a.CornerRadius = UDim.new(0.2, 0)
      guiElements.Jump_b = Instance.new("TextButton", guiElements.Frame_2)
      guiElements.Jump_b.TextWrapped = true
      guiElements.Jump_b.BorderSizePixel = 0
      guiElements.Jump_b.TextScaled = true
      guiElements.Jump_b.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
      guiElements.Jump_b.BackgroundTransparency = 0.7
      guiElements.Jump_b.Size = UDim2.new(0.12299, 0, 0.1844, 0)
      guiElements.Jump_b.Text = "jump"
      guiElements.Jump_b.Name = "Jump"
      guiElements.Jump_b.Position = UDim2.new(0.87452, 0, 0.67305, 0)
      guiElements.UICorner_c = Instance.new("UICorner", guiElements.Jump_b)
      guiElements.UICorner_c.CornerRadius = UDim.new(0.2, 0)
      guiElements.UIAspectRatioConstraint_d = Instance.new("UIAspectRatioConstraint", guiElements.Frame_2)
      guiElements.UIAspectRatioConstraint_d.AspectRatio = 1.93759
      guiElements.W_3.MouseButton1Down:Connect(function()
        -- line: [0, 0] id: 11
        isForwardPressed = true
      end)
      guiElements.W_3.MouseButton1Up:Connect(function()
        -- line: [0, 0] id: 8
        isForwardPressed = false
      end)
      guiElements.A_5.MouseButton1Down:Connect(function()
        -- line: [0, 0] id: 16
        isLeftPressed = true
      end)
      guiElements.A_5.MouseButton1Up:Connect(function()
        -- line: [0, 0] id: 13
        isLeftPressed = false
      end)
      guiElements.D_7.MouseButton1Down:Connect(function()
        -- line: [0, 0] id: 12
        isRightPressed = true
      end)
      guiElements.D_7.MouseButton1Up:Connect(function()
        -- line: [0, 0] id: 9
        isRightPressed = false
      end)
      guiElements.S_9.MouseButton1Down:Connect(function()
        -- line: [0, 0] id: 10
        isBackPressed = true
      end)
      guiElements.S_9.MouseButton1Up:Connect(function()
        -- line: [0, 0] id: 15
        isBackPressed = false
      end)
      guiElements.Jump_b.MouseButton1Click:Connect(function()
        -- line: [0, 0] id: 14
        verticalVelocity = jumppower
      end)
      return guiElements.ScreenGui_1, require
    end
  end)
  initializeCamera()
  onCharacterAdded(character)
  table.insert(someTable, LocalPlayer.CharacterAdded:Connect(onCharacterAdded))

StarterGui:SetCore("SendNotification", {
    Title = "fe hat snake";
    Text = "deobfuscated by gorfers";
    Duration = 5; -- seconds
})

Features & Information

so basically, its just impatricks hat snake script but i decompiled it so u can change anything about it from the speed to the height (zenith decompiler was used for this) DO NOT ZOOM OUT OR IN (it breaks ur camera)
#snake#hat#fe#decompiled#free

Community Comments (12)

BoomVoyBoyBoomVoyBoyNov 29, 2025

Ah I see this before what it call Im patrick

Replying to @BoomVoyBoy
gorfersgorfersNov 29, 2025

@BoomVoyBoy yup, its his script, i just decompiled it for easier access to editing it

jjrrooadlinejjrrooadlineNov 29, 2025

is zenith decompiler paid?

Replying to @jjrrooadline
yaruyaruNov 29, 2025

@jjrrooadline is it

Replying to @yaru
gorfersgorfersNov 29, 2025

@saikalovesyou no it isnt

Replying to @gorfers
jjrrooadlinejjrrooadlineNov 30, 2025

@gorfers where'd you get it, did you make it?

Replying to @jjrrooadline
gorfersgorfersNov 30, 2025

@jjrrooadline search up zenith deobfuscator on scriptblox

Replying to @gorfers
jjrrooadlinejjrrooadlineNov 30, 2025

@gorfers alr thanks

Replying to @gorfers
jjrrooadlinejjrrooadlineNov 30, 2025

@gorfers how does it work?

Replying to @jjrrooadline
gorfersgorfersNov 30, 2025

@jjrrooadline you paste ur lua text file with the obfuscated moonsec code and then download the deobfuscated code, then go to https://luadec.metaworm.site/ to make it readable and edit it (which is optional)

Replying to @gorfers
jjrrooadlinejjrrooadlineNov 30, 2025

@gorfers yooo thats fire thank you

Replying to @jjrrooadline
gorfersgorfersNov 29, 2025

@jjrrooadline nope

More Scripts for Universal Scripts