RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Make a kick script which let's you pick a player to kick"
-- This is a community contribution and has not been generated by ScripterAI local Players = game:GetService("Players") local owner = game.CreatorId Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(message) if string.sub(message, 1, 6) == "!kick " then local playerToKick = string.sub(message, 7) local foundPlayer = false if playerToKick == "me" then playerToKick = player.Name end for i, p in pairs(Players:GetPlayers()) do if p.Name == playerToKick then if player.userId == owner then local confirmation = Instance.new("ScreenGui") local confirmFrame = Instance.new("Frame") local confirmText = Instance.new("TextLabel") local confirmButton = Instance.new("TextButton") confirmation.Name = "ConfirmationScreen" confirmation.Parent = player.PlayerGui confirmFrame.Name = "ConfirmFrame" confirmFrame.Parent = confirmation confirmFrame.Size = UDim2.new(0, 300, 0, 175) confirmFrame.AnchorPoint = Vector2.new(0.5, 0.5) confirmFrame.Position = UDim2.new(0.5, 0, 0.5, 0) confirmFrame.BackgroundColor3 = Color3.fromRGB(255, 255, 0) confirmFrame.BorderSizePixel = 2 confirmFrame.BorderColor3 = Color3.fromRGB(255, 165, 0) confirmText.Name = "ConfirmText" confirmText.Parent = confirmFrame confirmText.Size = UDim2.new(1, -40, 0, 80) confirmText.Position = UDim2.new(0, 20, 0, 20) confirmText.Text = "Uh oh!\nAre you sure you want to kick\n" .. playerToKick .. "?" confirmText.TextColor3 = Color3.fromRGB(255, 0, 0) confirmText.TextWrapped = true confirmText.TextScaled = true confirmText.Font = Enum.Font.Cartoon confirmText.TextSize = 20 confirmButton.Name = "ConfirmButton" confirmButton.Parent = confirmFrame confirmButton.Size = UDim2.new(1, -40, 0, 50) confirmButton.Position = UDim2.new(0, 20, 0, 110) confirmButton.Text = "Kick 'em out!" confirmButton.TextColor3 = Color3.fromRGB(255, 255, 255) confirmButton.BackgroundColor3 = Color3.fromRGB(255, 165, 0) confirmButton.BorderSizePixel = 2 confirmButton.BorderColor3 = Color3.fromRGB(255, 0, 0) confirmButton.Font = Enum.Font.Cartoon confirmButton.TextSize = 20 confirmButton.MouseButton1Click:Connect(function() p:Kick("Guess I thought you were smelly lol") confirmation:Destroy() end) foundPlayer = true break end end end if not foundPlayer then player.Chat:Chat("Could not find player " .. playerToKick) end end end) end)