What I'm trying to do is kick players by typing in their name and clicking to kick. But the error that keep popping up is "Cannot kick a non-local Player from a LocalScript", which means, it only allows me to kick myself but not others... Any help?
--Made by IIApexGamerII, all credits go to Creator.
local VanGui = Instance.new("ScreenGui")
local Van = Instance.new("Frame")
local idk = Instance.new("TextBox")
local dsa = Instance.new("TextButton")
VanGui.Name = "Kick"
VanGui.Parent = game.Players.LocalPlayer.PlayerGui
Van.Name = "Kick"
Van.Parent = VanGui
Van.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
Van.BorderColor3 = Color3.new(0, 0, 0)
Van.Position = UDim2.new(0, 5, 0.8, 0)
Van.Size = UDim2.new(0, 200, 0, 45)
idk.Name = "idk"
idk.Parent = Van
idk.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
idk.BorderColor3 = Color3.new(0, 0, 0)
idk.Size = UDim2.new(1, 0, 0, 20)
idk.Font = Enum.Font.SciFi
idk.FontSize = Enum.FontSize.Size14
idk.Text = "Username"
idk.TextColor3 = Color3.new(1, 1, 1)
idk.TextScaled = true
idk.TextStrokeTransparency = 0
idk.TextWrapped = true
dsa.Name = "dsa"
dsa.Parent = Van
dsa.BackgroundColor3 = Color3.new(0.235294, 0.235294, 0.235294)
dsa.BorderColor3 = Color3.new(0, 0, 0)
dsa.Position = UDim2.new(0, 0, 1, -25)
dsa.Size = UDim2.new(1, 0, 0, 25)
dsa.Font = Enum.Font.SciFi
dsa.FontSize = Enum.FontSize.Size14
dsa.Text = "Kick a Player"
dsa.TextColor3 = Color3.new(1, 1, 1)
dsa.TextScaled = true
dsa.TextStrokeTransparency = 0
dsa.TextWrapped = true
dsa.MouseButton1Click:connect(function()
wait(0.2)
game.Players[idk.Text]:Kick("You were kicked by "..game.Players.LocalPlayer.Name..".")
end)
I would gladly appreciate it.

1 comment
you have to create a string value so that when you click the button, that string would be their name and after that you should make sure from a regular script to kick them