I’m trying to make a script that logs the developer console (server-sided console) and posts it on a UI.
Here’s what I got so far:
local LS = game:GetService("LogService")
local function OnMessageOut(message)
local TL = Instance.new("TextLabel")
TL.Parent = script.Parent
TL.Text = message
TL.BackgroundColor3 = Color3.new(15,15,15)
TL.BackgroundTransparency = 0.7
end
LS.MessageOut:Connect(OnMessageOut)
Here’s an example:
It doesn’t post anything on the scrollingframe.
I’m not looking for a spoonfeed, I’m just looking for a few explanations and ways to fix it.
I got an error(The current identity (2) cannot ServerMessageOut (lacking permission 5). I think I might need to use a ServerScript but it’s not possible to use ServerScripts on UIs.
That’s because ServerMessageOut is RobloxScriptSecurity (CoreScripts only). For the solution of your problem, why not use RemoteEvents to send messages from the server to the client?
You can use this to send from the server to the client with FireClient on the server
For simplicity sake, I’m going to use FireAllClients but be sure to have some sort of UserId whitelist
--// Server
local LogService = game:GetService("LogService")
-- your remote
local RE = Instance.new("RemoteEvent")
RE.Parent = RS
RE.Name = "newMessage"
LogService.MessageOut:Connect(function(message, messageType)
RE:FireAllClients(message, messageType)
end)
--// Client
local newMessage = RS:WaitForChild("newMessage")
newMessage.OnClientEvent:Connect(function(message, messageType)
-- display the log messages on the gui
end)
Something like this but doesn’t have to be exactly so