Hey, I have an admin logs system, yet when I want it to print out the command the player has run it gives nil and errors.
Error:
Players.max123lover2.PlayerGui.AdminGui.ChatLog.chatlog_handler:138: attempt to concatenate string with nil - Client - chatlog_handler:138
Local Script:
event.OnClientEvent:Connect(function(command, chatType)
if chatType == "ADMINLOG" then
print(command)
makeResizable(AdminFrame)
makeDraggable(AdminFrame)
local templateClone = template:Clone()
templateClone.Parent = AdminScrollingFrame
templateClone.Text = player.Name..": ".. command
end
end)
ServerScript:
local rs = game:GetService("ReplicatedStorage")
local sss = game:GetService("ServerScriptService")
local event = rs.Events.chatEvent
local commands = sss.AdminSystem.Commands
local prefix = "/"
game:GetService("Players").PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(msg)
if string.sub(msg, 1, 1) == prefix then
local command = commands:FindFirstChild(string.split(string.sub(msg, 2, #msg), " ")[1])
print(command)
event:FireClient(player, command, "ADMINLOG")
end
end)
end)
Can you please check that the item for the command exists? It will help if you get the string.split()[1] part outputted as well, to see what it is looking for
All of the commands are stored in ServerScriptService, an area which is unaccessible to the client, hence it does not see the command.
You’ll either need to find some other way to transfer the data in the command, or move the commands thing to replicated storage, in order to get it to work correctly
The remote event sends the object itself, but as the object is contained in an area the client can’t see, the remote event is unable to properly send the data.