Like the title says, how would I create a remote event with Knit Components Server to Client?
You just make a RemoteEvent, what’s the problem?
Currently to use the remote events with knit, its only communicate between controllers and services. How would I get remote events with components as well
Can you explain in greater detail of what you’re trying to achieve?
I am create a Remote Event using services. My issue is how to access those remote events using components.
So, you’re trying to make a set a variable as a RemoteEvent?
As I said, you just make a RemoteEvent like normal.
Knit has a fancy wrapping of RemoteEvents for Service-Controller communication.
The point isn’t for me to create the remote manually, but to use knit for that purpose.
in a service
local Knit = require(game:GetService("ReplicatedStorage").Knit)
local TestService = Knit.CreateService({
Name = "TestService", ​
})
function TestService.Client.GetPrintMessage(player) --expose this method to be usable for controllers
​ return "swag" --return this info to the controller calling this method
end
in a controller
local Knit = require(game:GetService("ReplicatedStorage").Knit)
local TestService = Knit.GetService("TestService")
local TestController = Knit.CreateController({
​ Name = "TestController", ​
})
function TestController:KnitStart()
print(TestService.GetPrintMessage())
--output: swag
end
there’s also a wrapper for RemoteEvent like someone else mentioned https://atollstudios.github.io/Knit/util/remotesignal/
Knit doesn’t do that for you.
I will say for the 3rd time, Knit has fancy RemoteEvent wrapper for Services, which is implemented with the Service’s client table in which you can expose methods and fields.
If you don’t create a Knit Service you don’t get the wrapped-client-table.
That being said you can still use Knit’s RemoteProperty which is just a wrapper for ValueBase objects. (it does allow tables but it’s pretty inefficient to pass tables because it replicates the entire table any time you make a change, for replicating tables look into ReplicaService)
If you want the normal functionality of a RemoteEvent, either:
- Create a RemoteEvent manually
- Create a wrapper for RemoteEvents
- Use an existing RemoteEvent wrapper (I use EasyNetwork by tyridge77)
Trying to use this, but what returns is always “Promise(Started)”.