Red - A simple, fast, and powerful networking library

Is there a way to yield on the client until an event has been fired? I want something like Event:Wait() for initialization. The closest I’ve come is using function-like events like so:

local data = Net:Call("RequestAllData"):Await()

I want to avoid calling the server though. I tried doing this (probably not using promises right here):

local data = Net:On("ReplicateAllData"):Await()

This returned nil and didn’t actually wait for anything. Is this not possible as of right now or am I just missing something…

You cannot wait for an event to be fired, no. What is your usecase for this? Red can probably help in this situation.

I was going to use this to wait for data that is necessary for some systems on the client to initialize, but I’ve thought of a better way of doing this now that I’m not trying to work on this at 1 am :stuck_out_tongue:. Thanks for the help! I like the library.

1 Like

Posting here in case anyone runs into this bug / error and is struggling to solve it like I was.

If every time you load your game, there’s a 50:50 chance Red doesn’t work and it gives you the “Retrieving identifier exceeded” error, you may accidentally have two “RedEvent” remote events in Replicated Storage! I have no idea how I ended up with 2 (Studio error I guess) but it was randomly choosing one on load and not working 50% of the time. Simply delete the extra event in Studio and it’ll work properly!

1 Like

I know this is nothing ground breaking or anything but just incase someone wants it.

function Server.FireInRange(self: Server, Origin : Vector3, Radius: number, EventName: string, ...)
	for _, Player in Players:GetPlayers() do
		local Distance = Player:DistanceFromCharacter(Origin);
		
		if Distance <= Radius then
			self:Fire(Player, EventName, ...);
		end
	end
end
1 Like

@jackdotink

Will there be an update that supports unreliable remote events?

1 Like

The update for red 2.0 that supports unreliable remotes is already finished and is on github awaiting tests before release.

5 Likes

Will 2.0 change anything that may require us to change code we’ve already made for Red?

I’m also quite hyped for the introduction of UnreliableEvents as they seem to be a very valuable asset when it comes to making a performant game.

2.0 has been out for some time, and is very different from 1.0.

The unreliable remotes update to 2.0 will require events that need to be unreliable to be rewritten as a new SharedEvent and their usage would need to be updated, but the updates to make there are minor.

Sorry, I hadnt noticed that 2.0 had been released because I had thought the old doc site would’ve listed a new version, can’t wait for the unreliable events thing to be finished as i already have some planned use cases for it.

Hey!

Its been a bit and I’ve just tried to implement Red 2.0 into my project and I’ve noticed three issues that will be causing me to stick with 1.2 for my projects in the future, #2 being that the new version complicates the installation for me having me install several plugins previously not needed, #1 How much it breaks my previous code for 1.2.

Since I will be sticking with 1.2, I wanted to know if there were any bugs and or potential problems with 1.2 so that I may mitigate them with any future code I create.

why document site is not working

  1. Danh sách các mục
1 Like

The docs site seems to have changed. It is now here

2 Likes

I’m running into an issue with sending false booleans through Red v2.2.0.

When I send true booleans, they send perfectly, without any issue. Sending false values seems to make it to the payload, but never make it to the listener.

After doing some testing, it seems like whenever false is the first argument, the rest of the arguments never make it past the payload, but whenever false is not the first argument, it can make it to the listener as expected.

How do integrate it with the Knit framework?

You can use knit to structure the game with services and controllers and then use red for the network communication

Red.Server() and Red.Client() for version 2.3.0 aren’t working, any alternative methods?

Documentation can’t be accessed

It looks like it was moved, the new link is in the top of the post (Red | Red)