Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Скрипт для ServerScriptService или StarterPlayerScripts
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local player = Players.LocalPlayer
- local character = player.CharacterAdded:Wait()
- local humanoid = character:WaitForChild("Humanoid")
- -- Создание GUI
- local screenGui = Instance.new("ScreenGui")
- screenGui.Name = "NoClipGUI"
- screenGui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- screenGui.Parent = player.PlayerGui
- -- Основной фрейм
- local mainFrame = Instance.new("Frame")
- mainFrame.Name = "MainFrame"
- mainFrame.Size = UDim2.new(0, 200, 0, 120)
- mainFrame.Position = UDim2.new(0, 10, 0, 10)
- mainFrame.BackgroundColor3 = Color3.new(0, 0, 0)
- mainFrame.BorderSizePixel = 2
- mainFrame.BorderColor3 = Color3.new(1, 0.5, 0)
- mainFrame.Active = true
- mainFrame.Draggable = false -- Мы реализуем перетаскивание самостоятельно
- mainFrame.Parent = screenGui
- -- Заголовок
- local titleLabel = Instance.new("TextLabel")
- titleLabel.Name = "TitleLabel"
- titleLabel.Size = UDim2.new(1, 0, 0, 30)
- titleLabel.Position = UDim2.new(0, 0, 0, 0)
- titleLabel.BackgroundColor3 = Color3.new(0, 0, 0)
- titleLabel.BorderSizePixel = 0
- titleLabel.Text = "QJL RbxScripts"
- titleLabel.TextColor3 = Color3.new(1, 0.5, 0)
- titleLabel.TextScaled = true
- titleLabel.Font = Enum.Font.GothamBold
- titleLabel.Parent = mainFrame
- -- Кнопка NoClip
- local noClipButton = Instance.new("TextButton")
- noClipButton.Name = "NoClipButton"
- noClipButton.Size = UDim2.new(0.8, 0, 0, 40)
- noClipButton.Position = UDim2.new(0.1, 0, 0.4, 0)
- noClipButton.BackgroundColor3 = Color3.new(1, 0.5, 0)
- noClipButton.BorderSizePixel = 0
- noClipButton.Text = "NOCLIP OFF"
- noClipButton.TextColor3 = Color3.new(0, 0, 0)
- noClipButton.TextScaled = true
- noClipButton.Font = Enum.Font.GothamBold
- noClipButton.Parent = mainFrame
- -- Переменные для состояния
- local noClipEnabled = false
- local noClipConnection = nil
- local isDragging = false
- local dragStart = nil
- local frameStart = nil
- -- Функция для перетаскивания GUI
- local function onInputBegan(input, gameProcessed)
- if gameProcessed then return end
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- local mousePos = input.Position
- local framePos = mainFrame.AbsolutePosition
- local frameSize = mainFrame.AbsoluteSize
- -- Проверяем, находится ли клик внутри фрейма
- if mousePos.X >= framePos.X and mousePos.X <= framePos.X + frameSize.X and
- mousePos.Y >= framePos.Y and mousePos.Y <= framePos.Y + frameSize.Y then
- isDragging = true
- dragStart = mousePos
- frameStart = mainFrame.Position
- -- Визуальная обратная связь при перетаскивании
- local tween = TweenService:Create(mainFrame, TweenInfo.new(0.1), {BackgroundColor3 = Color3.new(0.1, 0.1, 0.1)})
- tween:Play()
- end
- end
- end
- local function onInputChanged(input, gameProcessed)
- if gameProcessed then return end
- if isDragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then
- local delta = input.Position - dragStart
- local newPosition = UDim2.new(
- frameStart.X.Scale,
- frameStart.X.Offset + delta.X,
- frameStart.Y.Scale,
- frameStart.Y.Offset + delta.Y
- )
- mainFrame.Position = newPosition
- end
- end
- local function onInputEnded(input, gameProcessed)
- if gameProcessed then return end
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- if isDragging then
- isDragging = false
- -- Возвращаем обычный цвет
- local tween = TweenService:Create(mainFrame, TweenInfo.new(0.1), {BackgroundColor3 = Color3.new(0, 0, 0)})
- tween:Play()
- end
- end
- end
- -- Подключаем обработчики для перетаскивания
- UserInputService.InputBegan:Connect(onInputBegan)
- UserInputService.InputChanged:Connect(onInputChanged)
- UserInputService.InputEnded:Connect(onInputEnded)
- -- Функция NoClip
- local function updateNoClip()
- if character and humanoid then
- for _, part in pairs(character:GetDescendants()) do
- if part:IsA("BasePart") and part.CanCollide then
- part.CanCollide = not noClipEnabled
- end
- end
- end
- end
- -- Обработчик переключения NoClip
- noClipButton.MouseButton1Click:Connect(function()
- noClipEnabled = not noClipEnabled
- if noClipEnabled then
- noClipButton.Text = "NOCLIP ON"
- -- Анимация при включении
- local tween = TweenService:Create(noClipButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.new(0, 1, 0)})
- tween:Play()
- else
- noClipButton.Text = "NOCLIP OFF"
- -- Возвращаем оранжевый цвет
- local tween = TweenService:Create(noClipButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.new(1, 0.5, 0)})
- tween:Play()
- end
- updateNoClip()
- end)
- -- Постоянное обновление NoClip (на случай респавна персонажа)
- if noClipConnection then
- noClipConnection:Disconnect()
- end
- noClipConnection = RunService.Stepped:Connect(function()
- if noClipEnabled and character then
- updateNoClip()
- end
- end)
- -- Обработчик респавна персонажа
- player.CharacterAdded:Connect(function(newCharacter)
- character = newCharacter
- humanoid = character:WaitForChild("Humanoid")
- -- Сбрасываем NoClip при респавне
- if noClipEnabled then
- noClipEnabled = false
- noClipButton.Text = "NOCLIP OFF"
- local tween = TweenService:Create(noClipButton, TweenInfo.new(0.2), {BackgroundColor3 = Color3.new(1, 0.5, 0)})
- tween:Play()
- end
- end)
- -- Анимация появления
- mainFrame.Size = UDim2.new(0, 0, 0, 0)
- local appearTween = TweenService:Create(mainFrame, TweenInfo.new(0.5), {Size = UDim2.new(0, 200, 0, 120)})
- appearTween:Play()
- print("NoClip GUI загружен! Перетаскивайте окно для перемещения.")
Advertisement
Add Comment
Please, Sign In to add comment