like my script -- This code was generated by Cobalt -- https://github.com/notpoiu/cobalt -- Event originated from an Actor Environment for _, actor in getactors() do run_on_actor(actor, [[ local Event = game:GetService("ReplicatedStorag
To modify your script so that it intercepts an event when the first argument is "ping" and sets it to 0 before forwarding the arguments to the original `FireServer` method, you can adjust the `hookfunction` implementation. Below is the modified script which achieves this:
```lua
-- This code was generated by Cobalt
-- https://github.com/notpoiu/cobalt
-- Event originated from an Actor Environment
for _, actor in getactors() do
run_on_actor(actor, [[
local Event = game:GetService("ReplicatedStorage").UnreliableRemoteEvent
local mtHook; mtHook = hookmetamethod(game, "__namecall", function(...)
local self = ...
if rawequal(self, Event) and getnamecallmethod() == "FireServer" then
local Args = table.pack(...)
-- Intercept and modify the arguments if the first argument is "ping"
if Args[1] == "ping" then
Args[2] = 0 -- Set the value to 0
end
local Result = table.pack(
mtHook(self, table.unpack(Args, 1, Args.n))
)
print("Intercepted (__namecall) {" .. Event.Name .. "}:FireServer()", table.unpack(Args, 1, Args.n))
return table.unpack(Result, 1, Result.n)
end
return mtHook(...)
end)
local OldFireServer; OldFireServer = hookfunction(Event.FireServer, function(...)
local self = ...
if rawequal(self, Event) then
local Args = table.pack(...)
-- Intercept and modify the arguments if the first argument is "ping"
if Args[1] == "ping" then
Args[2] = 0 -- Set the value to 0
end
local Result = table.pack(
OldFireServer(table.unpack(Args, 1, Args.n))
)
print("Intercepted (__index) {" .. Event.Name .. "}:FireServer()", self, table.unpack(Args, 1, Args.n))
return table.unpack(Result, 1, Result.n)
end
return OldFireServer(self, ...)
end)
]])
end
```
### Changes Made:
1. **Argument Modification**: Within both the `hookmetamethod` and `hookfunction` implementations, I've added a check to determine if the first argument is `"ping"`. If it is, the second argument (the one that represents the time) is set to `0`.
2. **Print Statements**: The print statements were updated for clarity, displaying the arguments sent to the `FireServer` function.
This will ensure that whenever the `UnreliableRemoteEvent:FireServer` is called with `"ping"` as the first argument, it will be changed to use `0` instead.


