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)

1 comment
Instead of game.Players(plrname) you should do game.Players[plrname] because using the () on the object makes the code assume you are trying to use the Players object as a function.