Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UIS = game:GetService("UserInputService")
- local Players = game:GetService("Players")
- local frame = script.Parent
- local textBox = frame:FindFirstChild("TextBox")
- local button = frame:FindFirstChild("TextButton")
- local dragging = false
- local dragInput
- local dragStart
- local startPos
- -- Function to update the frame's position
- local function update(input)
- local delta = input.Position - dragStart
- frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
- end
- -- Function to kick player
- local function kickPlayer(username)
- local player = Players:FindFirstChild(username)
- if player then
- player:Kick("You have been kicked from the game.")
- else
- print("User not found.")
- end
- end
- -- Dragging functionality
- frame.InputBegan:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseButton1 then
- dragging = true
- dragStart = input.Position
- startPos = frame.Position
- input.Changed:Connect(function()
- if input.UserInputState == Enum.UserInputState.End then
- dragging = false
- end
- end)
- end
- end)
- frame.InputChanged:Connect(function(input)
- if input.UserInputType == Enum.UserInputType.MouseMovement then
- dragInput = input
- end
- end)
- UIS.InputChanged:Connect(function(input)
- if input == dragInput and dragging then
- update(input)
- end
- end)
- -- Button click functionality
- button.MouseButton1Click:Connect(function()
- local username = textBox.Text
- kickPlayer(username)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement