Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local key = Enum.KeyCode.T -- Клавиша для переключения невидимости
- local invis_on = false
- local cooldown = false
- -- Функция для показа уведомлений
- local function showNotification(title)
- game:GetService("StarterGui"):SetCore("SendNotification", {
- Title = title,
- Duration = 1,
- Text = "",
- })
- end
- -- Основная функция обработки нажатия клавиши
- local function onKeyPress(inputObject, gameProcessedEvent)
- if gameProcessedEvent or cooldown then return end
- if inputObject.KeyCode == key then
- cooldown = true
- local player = game:GetService("Players").LocalPlayer
- local character = player.Character
- if not character or not character:FindFirstChild("HumanoidRootPart") then
- cooldown = false
- return
- end
- invis_on = not invis_on
- if invis_on then
- -- Включаем невидимость
- local savedpos = character.HumanoidRootPart.CFrame
- character.HumanoidRootPart.CFrame = CFrame.new(0, -200, 0)
- local Seat = Instance.new('Seat')
- Seat.Anchored = false
- Seat.CanCollide = false
- Seat.Name = 'invischair'
- Seat.Transparency = 1
- Seat.Parent = workspace
- local torso = character:FindFirstChild("Torso") or character:FindFirstChild("UpperTorso")
- if torso then
- local Weld = Instance.new("Weld")
- Weld.Part0 = Seat
- Weld.Part1 = torso
- Weld.Parent = Seat
- end
- task.wait(0.15)
- Seat.CFrame = savedpos
- showNotification("Invis On")
- else
- -- Выключаем невидимость
- local chair = workspace:FindFirstChild('invischair')
- if chair then
- chair:Destroy()
- showNotification("Invis Off")
- end
- end
- task.wait(0.5)
- cooldown = false
- end
- end
- -- Подключаем обработчик ввода
- game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
- -- Очистка при выходе из игры (опционально)
- game:GetService("Players").LocalPlayer.CharacterRemoving:Connect(function()
- local chair = workspace:FindFirstChild('invischair')
- if chair then chair:Destroy() end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement