I just want to give some more info on the current status of Red, as there are a few known issues that have gone unfixed.
I’m currently a student, and don’t have a huge amount of time to work on this.
The next update will be large, consisting of new utilities, utilities being separated from the main Red module, and the event core being completely rewritten.
I’m also working on another datastore library, just in the prototyping phase, no real solid ideas yet.
Over the next couple weeks I’ll be able to work on Red a bit more than I have.
Red 2.0 will be releasing very soon! (Code is done, working on docs)
This major update will contain very little change to networking with red (removing definitions completely, adding identifiers). The only breaking change is utilities not being included with red, and are now separate packages. This major version is a complete rewrite, and includes some minor implementation changes.
For all the wally users out there, Red will be changing scopes to redblox/red. There are many reasons for this, but the two primary reasons are: Enable me to release more packages in the same ecosystem, I’ve said I’m planning a datastore library (and it’s almost done too), and I want to do a lot more. The second reason is to protect the users from me changing usernames and enable more contributions.
If you read this whole post, then thank you! If you have a game using red right now, and want to test out Red 2.0 just message me on discord and I’ll help you try it out. The migration process is very minimal.
I am trying to run Net:Call but for some reason I am being returned with the following message
Infinite yield possible on 'Players.7piral.PlayerGui:WaitForChild("Red")' - Studio Stack Begin - Studio Script 'ReplicatedStorage.Shared.Packages.Red.Net', Line 29 - Studio - Net:29 Stack End - Studio
Below is my code:
--SERVER
Net:On("GetProfile", function(Player)
return DataManager.Get(Player)
end)
--CLIENT
function NetworkingManager.GetProfile()
Net:Call("GetProfile"):Then(function(Profile)
return Profile
end)
end
I created a temporary release of Red while 2.0 is in a weird state. This patches the bug with calling yielding functions on the server. You can download here.
I am still receiving the same yield for some reason even after updating.
Heres a bit more of context to my code:
--server
local Net = Red.Server("Data")
local DataManager = {}
function DataManager.Get(Player)
local Profile = Profiles[Player]
if Profile then
return Profile
end
end
return DataManager
Net:On("GetProfile", function(Player)
return DataManager.Get(Player)
end)
--client
local DataNetwork = Red.Client("Data")
local NetworkingManager = {}
function NetworkingManager.GetProfile()
DataNetwork:Call("GetProfile"):Then(function(Profile)
return Profile
end)
end
return NetworkingManager
and simply running print(require(game:GetService("StarterPlayer").StarterPlayerScripts.Client.Modules["Networking"]).GetProfile()) causes the yield to occur
I am unsure if this is caused by something in my code or the module, but hopefully this can help
Really sorry I missed your response. Your issue appears to be in this code:
function NetworkingManager.GetProfile()
DataNetwork:Call("GetProfile"):Then(function(Profile)
return Profile -- this return is inside the Then callback
end)
end
If you want GetProfile to yield and then return the profile this is what you should do:
function NetworkingManager.GetProfile()
return DataNetwork:Call("GetProfile"):Await()
end
This isn’t a plugin, it is a networking library to assist with networking between the client and server. You can use the Signal utility if you’re looking for something similar to bindables.
I do have some interesting results that should help narrow this down
Upon using :Fire() it also shows the same yield error
It doesn’t actually print anything, even a simple print("Hello, world!") on the server so i am not sure its even contacting the server?
I have a second namespace in the same exact script, but its a OnClientEvent and it works perfectly fine. Im unsure if this is related to it or not but thought that would be helpful to know.
EDIT: On some more testing, I find it doesn’t even print on the client. I am using a :On() connection on a separate namespace above the same part, is this causing it? I will attach my full code below
--//Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
--//Imports
local Red = require(ReplicatedStorage.Shared.Packages["Red"])
local Effects = require(script.Parent["Effects"])
--//Constants
local LocalPlayer = Players.LocalPlayer
local EffectsNetwork = Red.Client("Effects")
local DataNetwork = Red.Client("Data")
--//Connections
EffectsNetwork:On("Vignette", function(Enabled, Type)
if Enabled == true then
if Type == "TimeZone" then
Effects:VignetteOn("TimeZone")
elseif Type == "SafeZone" then
Effects:VignetteOn("SafeZone")
end
else
Effects:VignetteOff()
end
end)
--//Module
local NetworkingManager = {}
function NetworkingManager.GetProfile()
print("Hi") -- This is not printing but the yield warning is showing
return DataNetwork:Call("GetProfile"):Await()
end
return NetworkingManager
Hey, so after trying a few new things I was able to get it working. Heres the steps I took to fix it:
I stopped using the command bar and used a script within the game itself to test, for whatever reason that seemed to be the main issue. I am still unsure why or if thats intended.
Instead of sending the entire profile (which was a cyclic table which ended up causing issues) i only sent the Profile.Data
So the command bar runs in it’s own environment, its kinda weird. Don’t run tests from it. Serializing cyclic tables will cause you no end of problems, so I’m glad you got all this sorted out. Let me know if you have any other questions!
I am testing how Red works and its working but getting the getting the message below, what am I doing wrong? is it because I have the server script in the Workspace?.
13:36:13.998 [Red.Serdes]: Retrieving identifier exceeded 5 seconds. Make sure ‘NamespaceName_EventName1’ is registered on the server. - Client
13:36:14.381: Test from server (x47) - Client - LocalScript:7
-- Server Script in Workspace
local Red = require(game:GetService("ReplicatedStorage").Red)
local Net = Red.Server("NamespaceName")
local Players = game:GetService("Players")
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = Players:GetPlayerFromCharacter(hit.Parent)
-- Fires a single player
Net:Fire(player, "EventName1", "Test from server")
end
end)
-- Client Script in StarterPlayerScripts
local Red = require(game:GetService("ReplicatedStorage").Red)
local Net = Red.Client("NamespaceName")
Net:On("EventName1", function(testext)
print(testext)
end)