Yesterday, I got this idea where you can use RemoteEvents instead of RemoteFunction, by using Attributes. Roblox said that Attributes are ~18x faster to create dynamically, and I wanted to compare to see if using this method is faster.
I tested it and found out and here are Result
Server
local RemoteFunction = game:GetService("ReplicatedStorage").RemoteFunction
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
RemoteFunction.OnServerInvoke = function(Player)
return "Bruh Hello"
end
RemoteEvent.OnServerEvent:Connect(function(Player: Player)
RemoteEvent:SetAttribute("Test", "Bruh Hello")
end)
Client
local RemoteFunction = game:GetService("ReplicatedStorage").RemoteFunction
local RemoteEvent = game:GetService("ReplicatedStorage").RemoteEvent
local start_time = tick()
print(RemoteFunction:InvokeServer())
print("With remotefunction" ,tick() - start_time)
-----------------------------------------------------------------------------
local start_time = tick()
RemoteEvent:FireServer()
RemoteEvent:GetAttributeChangedSignal("Test"):Wait()
print(RemoteEvent:GetAttribute("Test"))
print("With Attribute", tick() - start_time)
My results are
With RemoteFunction 1.7378270626068115
With Attribute 0.06311607360839844
But I’m wondering is this really a good idea?