Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local player = game.Players.LocalPlayer
- local screenGui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
- local userInputService = game:GetService("UserInputService")
- local tweenService = game:GetService("TweenService")
- --=================================
- -- 🔹 PHẦN 1: TẠO MENU + NÚT ẨN/HIỆN
- --=================================
- local menuFrame = Instance.new("Frame", screenGui)
- menuFrame.Size = UDim2.new(0, 250, 0, 170)
- menuFrame.BackgroundTransparency = 1
- menuFrame.Position = UDim2.new(0.5, -125, 0.5, -85)
- menuFrame.Visible = false
- menuFrame.ZIndex = 1
- -- Nút Ẩn/Hiện
- local toggleButton = Instance.new("TextButton", screenGui)
- toggleButton.Size = UDim2.new(0, 50, 0, 50) -- Hình vuông
- toggleButton.Position = UDim2.new(0, 50, 0, 50)
- toggleButton.BackgroundColor3 = Color3.fromRGB(0, 0, 0) -- Màu đen
- toggleButton.Text = "" -- Bỏ chữ
- -- Thêm hình troll face
- local trollFaceImage = Instance.new("ImageLabel", toggleButton)
- trollFaceImage.Size = UDim2.new(1.2, 0, 1.2, 0) -- Lớn hơn nút một chút
- trollFaceImage.Position = UDim2.new(-0.1, 0, -0.1, 0) -- Dịch ra ngoài viền nút
- trollFaceImage.Image = "rbxassetid://12345678" -- Thay thế bằng ID chính xác
- trollFaceImage.BackgroundTransparency = 1
- trollFaceImage.BorderSizePixel = 0
- --=================================
- -- 🔹 PHẦN 2: TẠO FRAME KÉO ĐÈ LÊN MENU
- --=================================
- local dragFrame = Instance.new("ScrollingFrame", menuFrame)
- dragFrame.Size = UDim2.new(0.98, 0, 0.98, 0)
- dragFrame.Position = UDim2.new(0.010, 0, 0.010, 0)
- dragFrame.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
- dragFrame.BackgroundTransparency = 0
- dragFrame.BorderSizePixel = 0
- dragFrame.ZIndex = 2
- dragFrame.CanvasSize = UDim2.new(0, 0, 2, 0) -- Cho phép kéo nội dung xuống
- dragFrame.ScrollBarThickness = 5 -- Độ dày thanh cuộn
- dragFrame.ScrollBarImageColor3 = Color3.fromRGB(255, 255, 255) -- Màu thanh cuộn
- local isDraggingMenu = false
- local tweenInfo = TweenInfo.new(0.1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
- dragFrame.InputBegan:Connect(function(input)
- -- Không cho phép kéo nếu đang tương tác với dragFrame
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDraggingMenu = false
- end
- end)
- userInputService.InputChanged:Connect(function(movingInput)
- if isDraggingMenu and movingInput.UserInputType == Enum.UserInputType.MouseMovement then
- local targetPosition = UDim2.new(0, movingInput.Position.X - menuFrame.Size.X.Offset / 2, 0, movingInput.Position.Y - dragFrame.Size.Y.Offset / 2)
- local tween = tweenService:Create(menuFrame, tweenInfo, {Position = targetPosition})
- tween:Play()
- end
- end)
- dragFrame.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDraggingMenu = false
- end
- end)
- --=================================
- -- 🔹 PHẦN 3: HIỆU ỨNG RGB (TOÀN MENU)
- --=================================
- local uiGradient = Instance.new("UIGradient", menuFrame)
- uiGradient.Rotation = 0
- uiGradient.Color = ColorSequence.new({
- ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)),
- ColorSequenceKeypoint.new(0.2, Color3.fromRGB(255, 255, 0)),
- ColorSequenceKeypoint.new(0.4, Color3.fromRGB(0, 255, 0)),
- ColorSequenceKeypoint.new(0.6, Color3.fromRGB(0, 255, 255)),
- ColorSequenceKeypoint.new(0.8, Color3.fromRGB(255, 0, 255)),
- ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 0))
- })
- local stroke = Instance.new("UIStroke", menuFrame)
- stroke.Thickness = 5
- stroke.Color = Color3.fromRGB(0, 0, 0)
- stroke.Transparency = 0.5
- task.spawn(function()
- while true do
- for i = 0, 360, 8 do
- uiGradient.Rotation = i
- task.wait(0.02)
- end
- end
- end)
- --=================================
- -- 🔹 PHẦN 4: CHỨC NĂNG TRONG DRAGFRAME (MỞ RỘNG MƯỢT + HIỂN THỊ CẤP)
- --=================================
- --=================================
- -- 🔹 PHẦN 5: CHỨC NĂNG MENU (ẨN/HIỆN + CẬP NHẬT VỊ TRÍ)
- --=================================
- local function updateMenuPosition()
- menuFrame.Position = toggleButton.Position + UDim2.new(0, toggleButton.Size.X.Offset + 15, 0, 0)
- end
- local isDragging = false
- toggleButton.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = true
- end
- end)
- userInputService.InputChanged:Connect(function(movingInput)
- if isDragging and movingInput.UserInputType == Enum.UserInputType.MouseMovement then
- toggleButton.Position = UDim2.new(0, movingInput.Position.X, 0, movingInput.Position.Y)
- updateMenuPosition()
- end
- end)
- toggleButton.InputEnded:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- isDragging = false
- end
- end)
- local function toggleMenu()
- local isVisible = not menuFrame.Visible
- local tweenTime = 0.25 -- Chỉnh thời gian ẩn/hiện menu
- local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Quad, Enum.EasingDirection.Out)
- local tween = tweenService:Create(menuFrame, tweenInfo, {BackgroundTransparency = isVisible and 0 or 1})
- if isVisible then
- updateMenuPosition()
- menuFrame.Visible = true
- tween:Play()
- else
- tween:Play()
- tween.Completed:Connect(function()
- menuFrame.Visible = false
- end)
- end
- end
- toggleButton.MouseButton1Click:Connect(toggleMenu)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement