local Players = game:GetService("Players") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local screenGui = Instance.new("ScreenGui") screenGui.Name = "CrouchButtonGui" screenGui.ResetOnSpawn = false screenGui.Parent = playerGui local mainButton = Instance.new("TextButton") mainButton.Name = "MainButton" mainButton.Size = UDim2.new(0, 80, 0, 80) mainButton.Position = UDim2.new(0.5, -40, 0.7, -40) mainButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40) mainButton.Text = "Crouch" mainButton.TextColor3 = Color3.fromRGB(255, 255, 255) mainButton.TextSize = 14 mainButton.AutoButtonColor = true mainButton.Parent = screenGui local mainCorner = Instance.new("UICorner") mainCorner.CornerRadius = UDim.new(1, 0) mainCorner.Parent = mainButton local lockButton = Instance.new("TextButton") lockButton.Name = "LockToggle" lockButton.Size = UDim2.new(0, 24, 0, 24) lockButton.Position = UDim2.new(1, -6, 0, -6) lockButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) lockButton.Text = "" lockButton.AutoButtonColor = false lockButton.Parent = mainButton local lockCorner = Instance.new("UICorner") lockCorner.CornerRadius = UDim.new(1, 0) lockCorner.Parent = lockButton local isDraggable = true local isDragging = false local mousePos, framePos lockButton.MouseButton1Click:Connect(function() isDraggable = not isDraggable if isDraggable then lockButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) else lockButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) end end) mainButton.InputBegan:Connect(function(input) if (input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch) then if isDraggable then isDragging = true mousePos = input.Position framePos = mainButton.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then isDragging = false end end) end end end) UserInputService.InputChanged:Connect(function(input) if isDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - mousePos mainButton.Position = UDim2.new( framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y ) end end) local animationId = "rbxassetid://287325678" local animTrack = nil local defaultWalkSpeed = 16 local function setupCharacter(character) local humanoid = character:WaitForChild("Humanoid") local animator = humanoid:WaitForChild("Animator") defaultWalkSpeed = humanoid.WalkSpeed local animation = Instance.new("Animation") animation.AnimationId = animationId animTrack = animator:LoadAnimation(animation) animTrack.Stopped:Connect(function() if humanoid and humanoid.Health > 0 then humanoid.WalkSpeed = defaultWalkSpeed end end) end if player.Character then setupCharacter(player.Character) end player.CharacterAdded:Connect(setupCharacter) local clickTime = 0 mainButton.MouseButton1Down:Connect(function() clickTime = tick() end) mainButton.MouseButton1Up:Connect(function() if tick() - clickTime < 0.2 and not isDragging then local character = player.Character if character then local humanoid = character:FindFirstChildOfClass("Humanoid") if humanoid and animTrack then if animTrack.IsPlaying then animTrack:Stop() humanoid.WalkSpeed = defaultWalkSpeed else defaultWalkSpeed = humanoid.WalkSpeed humanoid.WalkSpeed = 9 animTrack:Play() end end end end end)