I'm trying to make a kick GUI, but this keeps popping up
16:19:38.321 - Trying to call method on object of type: Players
with incorrect arguments.
16:19:38.322 - Stack Begin
16:19:38.322 - Script 'ServerScriptService.ScriptingEvents.KickPlayerReason', Line 5
16:19:38.323 - Stack End
I'll put both scripts if needed:
--SERVER SCRIPT-- local RS = game:GetService("ReplicatedStorage") local twigger = RS.OwnerRemotes:WaitForChild("KickFrame") twigger.OnServerEvent:Connect(function(plr, plrname, reason) game.Players(plrname):Kick(plrname.Value.. "|".. (reason.Value)) -- The problem/error end)
--LOCAL SCRIPT-- local RS = game:GetService("ReplicatedStorage") local remotea = RS.OwnerRemotes:WaitForChild("KickFrame") script.Parent.CB.MouseButton1Click:Connect(function() local yeeter = script.Parent.reasonBox.reasonValue local yeet = script.Parent.userBox.userValue remotea:FireServer(yeet, yeeter) end)
First of all, this remote is easily exploitable.
and, you're indexing the player wrongly.
--part of server code game.Players[plrname]:Kick(plrname.. '|' .. reason) --part of client code remotea:FireServer(yeet.Value, yeeter.Value)