It was just task.wait()
without any timer
Hi there is a problem when i send 4 things from client to server using the request thingy:
server script:
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:OnRequest(function(bool,msg,amsg,number)
print(bool,msg,amsg,number)
return msg == "ha"
end)
localscript:
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:Request(true,"hwewq","string",281):andThen(function(plr,msg)
print(msg)
print(plr)
end)
the first two print out fine but the other 2 prints nil.
when i try swapping the code around so that the server sends to client instead of client to server and send my player, it errors: 11:10:06.992 [NetRay RequestClient Error - test] No handler registered for incoming S2C request. - Client - RequestClient:78 11:10:07.050 ReplicatedStorage.NetRay.Server.RequestServer:458: attempt to call a nil value - Server - RequestServer:458
Try wrapping it in brackets like {true,“hello”,etc}
Ok
type or paste code here
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:Request({true,"tra",128,"place"}):andThen(function(msg)
print(msg)
end)
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:OnRequest(function(plr,msg,num,pla)
task.wait(1)
print(plr,msg,num,pla)
return msg == "h"
end)
output:
zak_isla ▼ {
[1] = true,
[2] = "tra",
[3] = 128,
[4] = "place"
} nil nil - Server - Script:5
15:38:05.971 false - Client - LocalScript:4
the players name has a table with all the stuff i sent in it, then the other ones i sent just come as nil
The false message was from trying to return a message back im not sure if im using it correctly.
ive also tried sending it like this:
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:Request({true},{"tra"},{128},{"place"}):andThen(function(msg)
print(msg)
end)
and it came out like this:
zak_isla ▶ {...} nil nil - Server - Script:5
zak_isla ▼ {
[1] = true
}
local n = require(game.ReplicatedStorage.NetRay)
local event = n:RegisterRequestEvent("test")
event:OnRequest(function(plr,info)
print(table.unpack(info))
task.wait(1)
return "h"
end)
try this
it worked: true tra 128 place - Server - Script:5 16:48:55.763 h - Client - LocalScript:4
How secure is this from Exploiters? Like how easy is it to just require?
There’s no way to deny exploiters access to the module.
They can send events, but there are many limits and other security measures in NetRay, which you can read more about on the documentation.
Well technically on the client you can just get the event via :GetEvent() and send it, but if you setup type checking and a middlewear etc they can’t really do much as it will just reject either sending the data or when the server receives it
Heyo, I would like some help when you get the chance. I was able to use NetRay on my other game fine, but i’m trying to practice making a push ability with NetRay. The video below you can see that it only fires to the server once and disregards any other fire events after that.
--PushClient.lua
-- Libs
local NetRay = require(ReplicatedStorage.Libs.NetRay)
-- Networking
local pushEvent = NetRay:GetEvent("Push")
function PushClient:Listen()
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == self.Settings.UserSettings.PushKeyCode and not self.PushSettings.Debounce then
self.PushSettings.Debounce = true
local root = self.Player.Character.PrimaryPart
local forwardOffset = root.CFrame.LookVector * 4
local hitbox = script.Hitbox:Clone()
hitbox.Position = root.Position + forwardOffset
hitbox.Parent = workspace
for _, part in workspace:GetPartsInPart(hitbox) do
local humanoid = part.Parent:FindFirstChild("Humanoid") or part:FindFirstChild("Humanoid")
if humanoid then
local character = humanoid.Parent
local data = {
target = character.Name,
--instanceCFrame = hitbox.CFrame,
}
print("Yeah theres a humanoid firing to server")
pushEvent:FireServer(data)
break
end
end
Debris:AddItem(hitbox, .3)
task.wait(self.PushSettings.Cooldown)
self.PushSettings.Debounce = false
end
end)
pushEvent:OnEvent(function(data)
print("Responded to client")
end)
end
I believe everything on the client is fine-- the server script will be applied below.
--PushServer.lua
local NetRay = require(ReplicatedStorage.Libs.NetRay)
local pushEvent = NetRay:RegisterEvent("Push",
{
priority = NetRay.Priority.HIGH,
}
)
function PushServer:Listen()
pushEvent:OnEvent(function(player, data)
print(player, data)
local target = workspace:FindFirstChild(data.target)
if player.Name == data.target or not target then return end
pushEvent:FireClient(player, {success = true})
target.Humanoid:TakeDamage(10)
end)
end
Interesting, I’ll try replicate it on my computer soon and get back to you
I am unable to replicate the issue, It might be an issue with your NetRay Version?
my test code
--PushClient.lua
-- Libs
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NetRay = require(ReplicatedStorage.NetRay)
local UserInputService = game:GetService("UserInputService")
local Player = game:GetService("Players").LocalPlayer
-- Networking
local pushEvent = NetRay:GetEvent("Push")
local Debris = game:GetService("Debris")
local Debounce = false
local PushKeyCode = Enum.KeyCode.Q
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.KeyCode == PushKeyCode and not Debounce then
Debounce = true
local root = Player.Character.PrimaryPart
local forwardOffset = root.CFrame.LookVector * 4
local hitbox = script.Hitbox:Clone()
hitbox.Position = root.Position + forwardOffset
hitbox.Parent = workspace
for _, part in workspace:GetPartsInPart(hitbox) do
local humanoid = part.Parent:FindFirstChild("Humanoid") or part:FindFirstChild("Humanoid")
if humanoid then
local character = humanoid.Parent
local data = {
target = character.Name,
--instanceCFrame = hitbox.CFrame,
}
print("Yeah theres a humanoid firing to server")
pushEvent:FireServer(data)
break
end
end
Debris:AddItem(hitbox, .3)
task.wait(2)
Debounce = false
end
end)
pushEvent:OnEvent(function(data)
print("Responded to client")
end)
and
--PushServer.lua
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local NetRay = require(ReplicatedStorage.NetRay)
local pushEvent = NetRay:RegisterEvent("Push",
{
priority = NetRay.Priority.HIGH,
}
)
pushEvent:OnEvent(function(player, data)
print(player, data)
local target = workspace:FindFirstChild(data.target)
if player.Name == data.target or not target then return end
pushEvent:FireClient(player, {success = true})
target.Humanoid:TakeDamage(10)
end)
I adjusted the script so I could test it myself
here is the place file I tested, video was to large
testing.rbxl (235.6 KB)
It seems to be working now, I just redownloaded the NetRay from github. No idea what was wrong with my old netray i downloaded on 4/9/2025 but if it works it works and dont touch it! Thank you so much!
Just wanted to comment the latest release is working flawless for me and feels great in my current game. Good stuff and great asset!
Thank you, I appreciate it.
If you find any issues or have suggestions don’t hesitate to let me know
Could we get benchmarks with v1.1.0?
It’s the same as the previous; it was more bug fixes and updating the batching system. However, if you do test with the new module, you will have to disable then disable the forced heartbeat flush
you can read the note I left it explains it better
Oh btw in the next version you should update Signal+. There’s an update with optimizations.
I’d actually recommend using the package, which you can download from GitHub. That way it automatically updates for everybody, as long as they have turned AutoUpdate
on.