Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ScreenGui = Instance.new("ScreenGui")
- local Frame = Instance.new("Frame")
- local UICorner = Instance.new("UICorner")
- local CloseButton = Instance.new("TextButton")
- local MinimizeButton = Instance.new("TextButton")
- local UserInputService = game:GetService("UserInputService")
- local TweenService = game:GetService("TweenService")
- local isMinimized = false
- local isFollowMenuOpen = false
- local isFollowing = false
- local isCollecting = false
- local isAutoCoinSettingsOpen = false
- local currentCoin = nil
- local isMovingToCoin = false
- local currentTarget = nil
- local UserInputService = game:GetService("UserInputService")
- local RunService = game:GetService("RunService")
- local Player = game.Players.LocalPlayer
- local Mouse = Player:GetMouse()
- local Character = Player.Character or Player.CharacterAdded:Wait()
- local Humanoid = Character:FindFirstChildOfClass("Humanoid")
- -- Настройка GUI
- ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
- Frame.Parent = ScreenGui
- Frame.Size = UDim2.new(0, 250, 0, 285) -- Размер окна
- Frame.Position = UDim2.new(0.5, -100, 0.5, -50) -- Размещение в центре
- Frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
- Frame.BackgroundTransparency = 0.15
- Frame.BorderSizePixel = 0
- Frame.Visible = false
- UICorner.Parent = Frame
- UICorner.CornerRadius = UDim.new(0, 15)
- local GUIHeader = Instance.new("TextLabel")
- GUIHeader.Parent = Frame
- GUIHeader.Size = UDim2.new(1, 0, 0, 30)
- GUIHeader.Position = UDim2.new(0, 0, 0, 0)
- GUIHeader.Text = "GUI by Zumhad"
- GUIHeader.TextColor3 = Color3.fromRGB(255, 255, 255)
- GUIHeader.Font = Enum.Font.SourceSansBold
- GUIHeader.TextSize = 20
- GUIHeader.BackgroundTransparency = 1
- -- Функция анимации появления
- local function fadeIn()
- Frame.Visible = true
- local tween = TweenService:Create(Frame, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {BackgroundTransparency = 0.15})
- tween:Play()
- end
- -- Функция анимации сворачивания
- local function fadeOut()
- local tween = TweenService:Create(Frame, TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out), {BackgroundTransparency = 1})
- tween:Play()
- tween.Completed:Connect(function()
- Frame.Visible = false
- end)
- end
- fadeIn()
- local ToggleButton = Instance.new("TextButton")
- ToggleButton.Parent = ScreenGui
- ToggleButton.Size = UDim2.new(0, 75, 0, 75) -- Увеличенный размер (50x50)
- ToggleButton.Position = UDim2.new(0, 10, 0.5, -250) -- Размещаем слева по центру
- ToggleButton.BackgroundColor3 = Color3.fromRGB(20, 20, 20) -- Чёрный цвет
- ToggleButton.BorderSizePixel = 0
- ToggleButton.Text = "MENU"
- ToggleButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- ToggleButton.Font = Enum.Font.SourceSansBold
- ToggleButton.TextSize = 20
- -- Убираем округление, чтобы был квадрат
- local ToggleUICorner = Instance.new("UICorner")
- ToggleUICorner.Parent = ToggleButton
- ToggleUICorner.CornerRadius = UDim.new(0, 5)
- -- Функция переключения видимости
- local function toggleMenu()
- if Frame.Visible then
- fadeOut()
- else
- fadeIn()
- end
- end
- -- Подключаем клик на кнопку
- ToggleButton.MouseButton1Click:Connect(toggleMenu)
- -- Кнопка Close
- CloseButton.Parent = Frame
- CloseButton.Size = UDim2.new(1, 0, 0, 40)
- CloseButton.Position = UDim2.new(0, 0, 1, -40)
- CloseButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- CloseButton.BackgroundTransparency = 0.15
- CloseButton.BorderSizePixel = 0
- CloseButton.Text = "CLOSE"
- CloseButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CloseButton.Font = Enum.Font.SourceSansBold
- CloseButton.TextSize = 20
- CloseButton.MouseButton1Click:Connect(function()
- ScreenGui:Destroy()
- isFollowing = false
- local character = game.Players.LocalPlayer.Character
- if character and character:FindFirstChild("Humanoid") then
- character.Humanoid:Move(Vector3.new(0, 0, 0)) -- Останавливаем движение
- end
- end)
- -- Кнопка свернуть
- MinimizeButton.Parent = Frame
- MinimizeButton.Size = UDim2.new(0, 30, 0, 30)
- MinimizeButton.Position = UDim2.new(1, -35, 0, 5)
- MinimizeButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- MinimizeButton.BackgroundTransparency = 0.15
- MinimizeButton.BorderSizePixel = 0
- MinimizeButton.Text = "-"
- MinimizeButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- MinimizeButton.Font = Enum.Font.SourceSansBold
- MinimizeButton.TextSize = 35
- MinimizeButton.MouseButton1Click:Connect(function()
- fadeOut()
- isMinimized = true
- end)
- UserInputService.InputBegan:Connect(function(input, gameProcessed)
- if not gameProcessed and input.KeyCode == Enum.KeyCode.LeftControl then
- if Frame.Visible then
- fadeOut()
- else
- fadeIn()
- end
- end
- end)
- -- Кнопка AutoCoin
- local AutoCoinButton = Instance.new("TextButton")
- AutoCoinButton.Parent = Frame
- AutoCoinButton.Size = UDim2.new(1, 0, 0, 40)
- AutoCoinButton.Position = UDim2.new(0, 0, 1, -190)
- AutoCoinButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- AutoCoinButton.BackgroundTransparency = 0.15
- AutoCoinButton.BorderSizePixel = 0
- AutoCoinButton.Text = "AUTOCOIN"
- AutoCoinButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- AutoCoinButton.Font = Enum.Font.SourceSansBold
- AutoCoinButton.TextSize = 20
- local AutoCoinSettings = Instance.new("Frame")
- AutoCoinSettings.Parent = Frame
- AutoCoinSettings.Size = UDim2.new(1, 0, 0, 140) -- Занимает всю ширину основного меню
- AutoCoinSettings.Position = UDim2.new(0, 0, 0, -150) -- Размещается сверху
- AutoCoinSettings.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- AutoCoinSettings.BackgroundTransparency = 0.15
- AutoCoinSettings.Visible = false
- local UICornerAutoCoin = Instance.new("UICorner")
- UICornerAutoCoin.Parent = AutoCoinSettings
- UICornerAutoCoin.CornerRadius = UDim.new(0, 10)
- AutoCoinButton.MouseButton1Click:Connect(function()
- isAutoCoinSettingsOpen = not isAutoCoinSettingsOpen
- AutoCoinSettings.Visible = isAutoCoinSettingsOpen
- end)
- local AutoCoinLabel = Instance.new("TextLabel")
- AutoCoinLabel.Parent = AutoCoinSettings
- AutoCoinLabel.Size = UDim2.new(1, 0, 0, 30)
- AutoCoinLabel.Position = UDim2.new(0, 0, 0, 5)
- AutoCoinLabel.Text = "Auto Collect Coin"
- AutoCoinLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- AutoCoinLabel.Font = Enum.Font.SourceSansBold
- AutoCoinLabel.TextSize = 20
- AutoCoinLabel.BackgroundTransparency = 1
- local CollectStatus = Instance.new("TextLabel")
- CollectStatus.Parent = AutoCoinSettings
- CollectStatus.Size = UDim2.new(1, 0, 0, 70)
- CollectStatus.Position = UDim2.new(0, 0, 0, 5)
- CollectStatus.Text = isFollowing and "STATUS ON" or "STATUS OFF"
- CollectStatus.TextColor3 = isFollowing and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- CollectStatus.Font = Enum.Font.SourceSansBold
- CollectStatus.TextSize = 20
- CollectStatus.BackgroundTransparency = 1
- local function updateCollectStatus()
- CollectStatus.Text = isCollecting and "STATUS ON" or "STATUS OFF"
- CollectStatus.TextColor3 = isCollecting and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- end
- local function getClosestCoin()
- local closestCoin = nil
- local minDistance = math.huge
- local playerPosition = Character.PrimaryPart.Position
- for _, obj in pairs(workspace:GetDescendants()) do
- if obj.Name == "Coin" and obj:IsA("BasePart") then
- local distance = (playerPosition - obj.Position).Magnitude
- if distance < minDistance then
- minDistance = distance
- closestCoin = obj
- end
- end
- end
- return closestCoin
- end
- local function moveToCoin()
- if not isCollecting then return end -- Если авто-сбор выключен, не двигаемся
- local humanoid = Character:FindFirstChildOfClass("Humanoid")
- if not humanoid then return end
- currentTarget = getClosestCoin()
- if currentTarget then
- print("🚀 Двигаемся к монете:", currentTarget.Name)
- isMovingToCoin = true
- while isCollecting and currentTarget do
- -- Обновляем путь каждые 0.1 секунды, чтобы избежать прерывания движения
- humanoid:MoveTo(currentTarget.Position)
- -- Если монета исчезла, выходим из цикла
- if not currentTarget or not currentTarget.Parent then
- print("❌ Монета исчезла!")
- break
- end
- task.wait(0.1)
- end
- isMovingToCoin = false -- Разблокируем движение
- else
- print("❌ Монет нет!")
- end
- end
- -- Кнопка ON
- local CollectOnButton = Instance.new("TextButton")
- CollectOnButton.Parent = AutoCoinSettings
- CollectOnButton.Size = UDim2.new(0, 80, 0, 30)
- CollectOnButton.Position = UDim2.new(0.5, -90, 0, 60)
- CollectOnButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- CollectOnButton.Text = "ON"
- CollectOnButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CollectOnButton.Font = Enum.Font.SourceSansBold
- CollectOnButton.TextSize = 18
- CollectOnButton.MouseButton1Click:Connect(function()
- isCollecting = true
- updateCollectStatus()
- print("🔵 Авто-сбор монет ВКЛЮЧЕН")
- while isCollecting do
- moveToCoin()
- task.wait(0.5) -- Ждем немного перед повторным поиском монеты
- end
- end)
- -- Кнопка OFF
- local CollectOffButton = Instance.new("TextButton")
- CollectOffButton.Parent = AutoCoinSettings
- CollectOffButton.Size = UDim2.new(0, 80, 0, 30)
- CollectOffButton.Position = UDim2.new(0.5, 10, 0, 60)
- CollectOffButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- CollectOffButton.Text = "OFF"
- CollectOffButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- CollectOffButton.Font = Enum.Font.SourceSansBold
- CollectOffButton.TextSize = 18
- CollectOffButton.MouseButton1Click:Connect(function()
- isCollecting = false
- isMovingToCoin = false
- updateCollectStatus()
- print("🔴 Авто-сбор монет ВЫКЛЮЧЕН")
- end)
- updateCollectStatus()
- -- Кнопка MoveSpeed
- local MoveSpeedButton = Instance.new("TextButton")
- MoveSpeedButton.Parent = Frame
- MoveSpeedButton.Size = UDim2.new(1, 0, 0, 40)
- MoveSpeedButton.Position = UDim2.new(0, 0, 1, -140)
- MoveSpeedButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- MoveSpeedButton.BackgroundTransparency = 0.15
- MoveSpeedButton.BorderSizePixel = 0
- MoveSpeedButton.Text = "MOVESPEED"
- MoveSpeedButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- MoveSpeedButton.Font = Enum.Font.SourceSansBold
- MoveSpeedButton.TextSize = 20
- local MoveSpeedSettings = Instance.new("Frame")
- MoveSpeedSettings.Parent = Frame
- MoveSpeedSettings.Size = UDim2.new(0, 200, 0, 140)
- MoveSpeedSettings.Position = UDim2.new(0, MoveSpeedButton.Position.X.Offset - 210, 1, -140)
- MoveSpeedSettings.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- MoveSpeedSettings.BackgroundTransparency = 0.15
- MoveSpeedSettings.Visible = false
- local MoveSpeedButtonLabel = Instance.new("TextLabel")
- MoveSpeedButtonLabel.Parent = MoveSpeedSettings
- MoveSpeedButtonLabel.Size = UDim2.new(1, 0, 0, 30)
- MoveSpeedButtonLabel.Position = UDim2.new(0, 0, 0, 5)
- MoveSpeedButtonLabel.Text = "MoveSpeed Settings"
- MoveSpeedButtonLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- MoveSpeedButtonLabel.Font = Enum.Font.SourceSansBold
- MoveSpeedButtonLabel.TextSize = 20
- MoveSpeedButtonLabel.BackgroundTransparency = 1
- local CurrentSpeedLabel = Instance.new("TextLabel")
- CurrentSpeedLabel.Parent = MoveSpeedSettings
- CurrentSpeedLabel.Size = UDim2.new(1, 0, 0, 30)
- CurrentSpeedLabel.Position = UDim2.new(0, 0, 0, 40)
- CurrentSpeedLabel.Text = "Current Speed: " .. tostring(game.Players.LocalPlayer.Character.Humanoid.WalkSpeed)
- CurrentSpeedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
- CurrentSpeedLabel.Font = Enum.Font.SourceSansBold
- CurrentSpeedLabel.TextSize = 18
- CurrentSpeedLabel.BackgroundTransparency = 1
- local IncreaseSpeedButton = Instance.new("TextButton")
- IncreaseSpeedButton.Parent = MoveSpeedSettings
- IncreaseSpeedButton.Size = UDim2.new(0, 80, 0, 30)
- IncreaseSpeedButton.Position = UDim2.new(0.5, -90, 0, 80)
- IncreaseSpeedButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- IncreaseSpeedButton.Text = "+1"
- IncreaseSpeedButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- IncreaseSpeedButton.Font = Enum.Font.SourceSansBold
- IncreaseSpeedButton.TextSize = 18
- local DecreaseSpeedButton = Instance.new("TextButton")
- DecreaseSpeedButton.Parent = MoveSpeedSettings
- DecreaseSpeedButton.Size = UDim2.new(0, 80, 0, 30)
- DecreaseSpeedButton.Position = UDim2.new(0.5, 10, 0, 80)
- DecreaseSpeedButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- DecreaseSpeedButton.Text = "-1"
- DecreaseSpeedButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- DecreaseSpeedButton.Font = Enum.Font.SourceSansBold
- DecreaseSpeedButton.TextSize = 18
- IncreaseSpeedButton.MouseButton1Click:Connect(function()
- local humanoid = game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
- if humanoid then
- humanoid.WalkSpeed = humanoid.WalkSpeed + 1
- CurrentSpeedLabel.Text = "Current Speed: " .. tostring(humanoid.WalkSpeed)
- end
- end)
- DecreaseSpeedButton.MouseButton1Click:Connect(function()
- local humanoid = game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
- if humanoid then
- humanoid.WalkSpeed = humanoid.WalkSpeed - 1
- CurrentSpeedLabel.Text = "Current Speed: " .. tostring(humanoid.WalkSpeed)
- end
- end)
- MoveSpeedButton.MouseButton1Click:Connect(function()
- MoveSpeedSettings.Visible = not MoveSpeedSettings.Visible
- CurrentSpeedLabel.Text = "Current Speed: " .. tostring(game.Players.LocalPlayer.Character.Humanoid.WalkSpeed)
- end)
- -- Кнопка FOLLOW
- local FollowButton = Instance.new("TextButton")
- FollowButton.Parent = Frame
- FollowButton.Size = UDim2.new(1, 0, 0, 40)
- FollowButton.Position = UDim2.new(0, 0, 1, -90)
- FollowButton.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- FollowButton.BackgroundTransparency = 0.15
- FollowButton.BorderSizePixel = 0
- FollowButton.Text = "FOLLOW"
- FollowButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- FollowButton.Font = Enum.Font.SourceSansBold
- FollowButton.TextSize = 20
- -- Окно настроек FOLLOW (расположено справа от FOLLOW)
- local FollowSettings = Instance.new("Frame")
- FollowSettings.Parent = Frame
- FollowSettings.Size = UDim2.new(0, 200, 0, 140)
- FollowSettings.Position = UDim2.new(0, FollowButton.Position.X.Offset + 260, 1, -140)
- FollowSettings.BackgroundColor3 = Color3.fromRGB(40, 40, 40)
- FollowSettings.BackgroundTransparency = 0.15
- FollowSettings.Visible = false
- local StatusLabel = Instance.new("TextLabel")
- StatusLabel.Parent = FollowSettings
- StatusLabel.Size = UDim2.new(1, 0, 0, 30)
- StatusLabel.Position = UDim2.new(0, 0, 0, 5)
- StatusLabel.Text = isFollowing and "STATUS ON" or "STATUS OFF"
- StatusLabel.TextColor3 = isFollowing and Color3.fromRGB(0, 255, 0) or Color3.fromRGB(255, 0, 0)
- StatusLabel.Font = Enum.Font.SourceSansBold
- StatusLabel.TextSize = 20
- StatusLabel.BackgroundTransparency = 1
- FollowButton.MouseButton1Click:Connect(function()
- isFollowMenuOpen = not isFollowMenuOpen
- FollowSettings.Visible = isFollowMenuOpen
- end)
- -- Поле для ввода никнейма
- local UsernameInput = Instance.new("TextBox")
- UsernameInput.Parent = FollowSettings
- UsernameInput.Size = UDim2.new(0, 180, 0, 30)
- UsernameInput.Position = UDim2.new(0.5, -90, 0, 80)
- UsernameInput.BackgroundColor3 = Color3.fromRGB(60, 60, 60)
- UsernameInput.TextColor3 = Color3.fromRGB(255, 255, 255)
- UsernameInput.Font = Enum.Font.SourceSansBold
- UsernameInput.TextSize = 18
- UsernameInput.PlaceholderText = "Enter username"
- UsernameInput.Text = ""
- -- Поле для вывода статуса
- local StatusMessage = Instance.new("TextLabel")
- StatusMessage.Parent = FollowSettings
- StatusMessage.Size = UDim2.new(1, 0, 0, 30)
- StatusMessage.Position = UDim2.new(0, 0, 0, 115)
- StatusMessage.Text = ""
- StatusMessage.TextColor3 = Color3.fromRGB(255, 255, 255)
- StatusMessage.Font = Enum.Font.SourceSansBold
- StatusMessage.TextSize = 18
- StatusMessage.BackgroundTransparency = 1
- local function moveToPlayer(targetPlayer)
- -- Если персонаж в данный момент движется к монете, не двигаемся к игроку
- if isMovingToCoin then return end
- local character = game.Players.LocalPlayer.Character
- if not character or not character:FindFirstChild("HumanoidRootPart") then return end
- local hrp = character.HumanoidRootPart
- local targetChar = targetPlayer.Character
- if not targetChar or not targetChar:FindFirstChild("HumanoidRootPart") then return end
- local targetHrp = targetChar.HumanoidRootPart
- -- Разворачиваемся в сторону игрока
- hrp.CFrame = CFrame.new(hrp.Position, targetHrp.Position)
- -- Двигаемся к цели
- local humanoid = character:FindFirstChild("Humanoid")
- if humanoid then
- humanoid:MoveTo(targetHrp.Position)
- humanoid.MoveToFinished:Wait() -- Ждем завершения движения
- end
- end
- -- Кнопка ON
- local FollowOnButton = Instance.new("TextButton")
- FollowOnButton.Parent = FollowSettings
- FollowOnButton.Size = UDim2.new(0, 80, 0, 30)
- FollowOnButton.Position = UDim2.new(0.5, -90, 0, 35)
- FollowOnButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- FollowOnButton.Text = "ON"
- FollowOnButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- FollowOnButton.Font = Enum.Font.SourceSansBold
- FollowOnButton.TextSize = 18
- -- Кнопка OFF
- local FollowOffButton = Instance.new("TextButton")
- FollowOffButton.Parent = FollowSettings
- FollowOffButton.Size = UDim2.new(0, 80, 0, 30)
- FollowOffButton.Position = UDim2.new(0.5, 10, 0, 35)
- FollowOffButton.BackgroundColor3 = Color3.fromRGB(80, 80, 80)
- FollowOffButton.Text = "OFF"
- FollowOffButton.TextColor3 = Color3.fromRGB(255, 255, 255)
- FollowOffButton.Font = Enum.Font.SourceSansBold
- FollowOffButton.TextSize = 18
- FollowOnButton.MouseButton1Click:Connect(function()
- local username = UsernameInput.Text
- local targetPlayer = nil
- for _, player in pairs(game.Players:GetPlayers()) do
- if player.Name == username then
- targetPlayer = player
- break
- end
- end
- if targetPlayer then
- isFollowing = true
- StatusLabel.Text = "STATUS ON"
- StatusLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
- StatusMessage.Text = "Player is online!"
- StatusMessage.TextColor3 = Color3.fromRGB(0, 255, 0)
- while isFollowing do
- moveToPlayer(targetPlayer)
- task.wait(0.1)
- end
- else
- StatusLabel.Text = "STATUS OFF"
- StatusLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
- StatusMessage.Text = "Player is not on the server!"
- StatusMessage.TextColor3 = Color3.fromRGB(255, 0, 0)
- end
- end)
- FollowOffButton.MouseButton1Click:Connect(function()
- StatusLabel.Text = "STATUS OFF"
- StatusLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
- isFollowing = false
- local character = game.Players.LocalPlayer.Character
- if character and character:FindFirstChild("Humanoid") then
- character.Humanoid:Move(Vector3.new(0, 0, 0)) -- Останавливаем движение
- end
- end)
- -- Переменные для движения основного меню
- local frameDragging, frameDragInput, frameDragStart, frameStartPos
- Frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- frameDragging = true
- frameDragStart = input.Position
- frameStartPos = Frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- frameDragging = false
- end
- end)
- end
- end)
- Frame.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- frameDragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == frameDragInput and frameDragging then
- local delta = input.Position - frameDragStart
- Frame.Position = UDim2.new(frameStartPos.X.Scale, frameStartPos.X.Offset + delta.X, frameStartPos.Y.Scale, frameStartPos.Y.Offset + delta.Y)
- end
- end)
- -- Переменные для движения ToggleButton
- local buttonDragging, buttonDragInput, buttonDragStart, buttonStartPos
- ToggleButton.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
- buttonDragging = true
- buttonDragStart = input.Position
- buttonStartPos = ToggleButton.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- buttonDragging = false
- end
- end)
- end
- end)
- ToggleButton.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
- buttonDragInput = input
- end
- end)
- UserInputService.InputChanged:Connect(function(input)
- if input == buttonDragInput and buttonDragging then
- local delta = input.Position - buttonDragStart
- ToggleButton.Position = UDim2.new(buttonStartPos.X.Scale, buttonStartPos.X.Offset + delta.X, buttonStartPos.Y.Scale, buttonStartPos.Y.Offset + delta.Y)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment