So I have admin commands in my game that I'm creating. One of the commands is a kick command. It starts with a prefix and a command when it fires a remote function then kicks a player. Well, that is what it should be doing in theory, but instead, it just gives me this error: OnServerInvoke is a callback member of RemoteFunction; you can only set the callback value, get is not available. I would like to know of a fix to this problem. Please help!
[ CLOSED ]
Thank you all for answering and I have given you all an upvote for your time!
Server Script:
local File = game:GetService("ReplicatedStorage")
local Object = File.AdminEvents["KE"]
Object.OnServerInvoke:Connect(function(player,target)
if target ~= nil then
target:Kick("Kicked by administrator.")
else
if target == nil then
warn"> Got command, target is nil."
end
end
end)
Local Script: ***** Works Fine *****
-- Code is shortened.
if(string.sub(CommandLine.Text,1,6)) == string.lower("!kick ") then
local target = string.sub(CommandLine.Text,7)
print(target)
game:GetService("ReplicatedStorage").AdminEvents["KE"]:InvokeServer
(target) -- This is one the same line just spaced it so it was visible.
CommandLine.Text = ""
end

1 comment
Thanks! This finally worked. As the end) is not correct in the server I have fixed that but other than that this worked perfectly! Thank you