Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I proceed with the kick gui without an error?

Asked by 6 years ago
Edited 6 years ago

Hello fellow mates. Today what I'm trying to do is create a kick script, so I already got everything set up, I just keep getting this error that says "attempt to call method 'Kick' (a nil value)

Can anyone help me with this error, gladly appreciate it

--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

p = idk.Text


dsa.MouseButton1Click:connect(function()
wait(0.2)
p:Kick() --Between the "()" you can name it whatever you want, for an example "p:Kick("Get out of here")
end)

"p = idk.Text" is suppose to be a equal to "idk.Text", which is where you would type the name of a player. (I probably made an error, but I'm positive this should have gone well... -_-)

1 answer

Log in to vote
1
Answered by 6 years ago

write this: game.Players[idk.Text]:Kick()

0
It works, but the only problem is, it only let me kick myself but not others since they are considered a "non-localplayer" from the local script. IIApexGamerII 76 — 6y
Ad

Answer this question