I’m currently experimenting with remote events and I’m trying to print stuff from within the function that’s bound to the OnClientEvent & OnServerEvent events.
If I’m running in play mode I would need to switch the current mode to the server to be able to receive prints from the OnClientEvent event function. The function is running within a local script so it’s pretty strange to me that I would need to switch the current mode to be the server to be able to read prints or debug within the OnClientEvent function.
Here’s how I set it up.
Server script running from ServerScriptService with RunContext set to Server
local UpdatePart = game.Workspace:WaitForChild("UpdatePart")
UpdatePart.OnServerEvent:Connect(OnUpdatePart)
function OnUpdatePart()
print("im the server, got called from client")
UpdatePart:FireAllClients()
end
Local script running from StarterPlayerScripts
local UpdatePart = game.Workspace:WaitForChild("UpdatePart")
UpdatePart.OnClientEvent:Connect(function()
print("im the client, got called from server")
UpdatePart:FireServer()
end)
I’ve tried moving the local script to StarterGui and the Workspace but both resulted in it not being printed for the client but works perfectly fine when switching the current mode to the server.
I’ve also tried using BindableEvents but that also resulted in the same issue.