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