Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

It won't kick the player?

Local script:

local RepStorage = game:GetService("ReplicatedStorage")
local Remote = RepStorage:WaitForChild("TestKickEvent")

script.Parent.MouseButton1Click:Connect(function()
	wait(0.1)
	Remote:FireServer(script.Parent.Parent.EnterNameForKick.Text)
end)

Server Script:

local RepStorage = game:GetService("ReplicatedStorage")
local Remote = RepStorage:WaitForChild("TestKickEvent")

Remote.OnServerEvent:Connect(function(player, name)
	name:Kick("test")
end)

Error: ServerScriptService.Script:5: attempt to call method 'Kick' (a nil value)

1 answer

Strings don't have a method called Kick. You can find a player associated with the string sent over the remote:

Remote.OnServerEvent:Connect(function(player, name)
    local pl = game.Players:FindFirstChild(name)
    if pl then
        pl:Kick('test haha')
    end
end)

2 comments

0

It doesnt kick the player though still

0

Then you aren't giving the RemoteEvent the right name? It's case sensitive

This discussion is preserved as it was. New answers, comments, and votes are closed.