Red - A simple, fast, and powerful networking library

And for some reason using Net:Call("Event") on the client won’t work?
Net:Fire("Event") works indeed.

I set it up like this to test the call method
Server:

Net = red.Server("BoxMechanicEvents", {"TestEvent"})
Net:On("TestEvent", function(player, message)
   return message
end)

Client:

Net = red.Client("BoxMechanicEvents")
local message = Net:Call("TestEvent", "Test Message")

This is the error and it’s been firing every frame from the Clock Util module

Can’t figure out what am i missing.

EDIT:
I have tested it on an older version of Red (1.0.0) and it works completely fine now. Haven’t tested it on (1.1.0) yet.

I think this is a bug?

1 Like

dynamically assigning events is a memory leak in red, you should never stop listening to them

1 Like

I’ll investigate this, give me some time.

1 Like

Release 1.2.1

  • Fixed error when client calls function-like events

Released on github and wally.

2 Likes

So what if a client script Listens to server events? and the client script gets destroyed? Does that mean it creates memory leaks? since it stopped listening?

1 Like

I’m not sure how Clock is supposed to work. I understand the initiative behind it, but this code doesn’t work.

local Red = require(game:GetService("ReplicatedStorage").Red)
local Clock  = Red.Clock

local NewClock = Clock.new(1, function()
    print("new clock 1")
end)

local NewClock2 = Clock.new(1, function()
    print("new clock 2")
end)

NewClock2:Pause()
task.wait(5)
NewClock:Pause() -- prints "new clock 1" 5 times + it works only upto here
NewClock2:Resume()

You cannot resume a second clock, what’s the issue here?

(That is a test code)

1 Like

Change the clock module on function resume and pause to self.Connected instead
image
image

This worked for me. Since I can’t resume it either.

1 Like

Release 1.2.2

  • Fixed bug with clock

Released on github and wally.

1 Like

Ah, I was trying to find the issue in the module itself, didn’t notice that though, lol.

Thanks for that!

1 Like

Can you tell us how newbies of learning Roblox’s networking system should understand the benchmarking? It doesn’t help that only a few white and interactable buttons on the screen could make them understand how it works.

Can you also share us where to know and understand more of Roblox’s networking system?

Overall I think this module is pretty handy if you want to ensure your game is smooth in terms of network.

1 Like

I am not sure if I am doing something wrong but correct me if I am. But when I fire from the Client > Server It works fine, but if I fire from Server > Client I keep getting a warning That I need to Register the EventName on the Server first? I even tried Setting NameSpace the same and Sending the Event yet nothing happens.

1 Like

Make sure you’re using the latest version, if you are then send me your code and I’ll take a look.

1 Like

Here is the current code that I am using to fire from the server to All Clients, But when ran is something along the lines of “[Red.Serdes]: Retrieving identifier exceeded 5 seconds. Make sure ‘TestName_TestName’ is registered on the server.”

--// Client

local Red = require(game.ReplicatedStorage:WaitForChild("Red"))

local Net = Red.Client("TestName")

Net:On("TestName", function()
	print("Hello from server!")
end)
--// Server

local Red = require(game.ReplicatedStorage:WaitForChild("Red"))

local Net = Red.Server("TestName")

Net:FireAll("TestName")
1 Like

Hi, im currently trying to use a networking library. But i stumbled across both red and bridgenet2.

Is there any differences on performance on these two other than bridgenet2 being more complicated

2 Likes

You have to Net:Fire(“TestName”) on Player Added,

reason why what you did doesn’t work is because Net:FireAll(“TestName”) fires before the player joined, thus could not be registered on the client.

1 Like

Interesting, although I thought you would only have to add Player when firing to the players client not to all clients

1 Like

Client means player, you have to fire to every client that joins the game to register it on that client and prevent that error

local Net = Red.Server("TestName")

local function onPlayerAdded(player)
    Net:Fire(player, "TestName")
end

Players.PlayerAdded:Connect(onPlayerAdded)

for i,player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end

Still doesn’t work either way and that’s only firing for the Player that joins. I need to fire for all the clients using Net:FireAll()

-- Fires all players
Net:FireAll("EventName", ...)

Seems to not work and won’t print anything either

Check the edited version.

Put this on the bottom

for i,player in pairs(Players:GetPlayers()) do
	onPlayerAdded(player)
end

Even doing that won’t print anything in the output to the client. The only thing that works is Client > Server not Server > Client