RemoteRequestValidator - Simple solution for validating parameters for remote instances


Hi there! I just created a module that allows you verify the parameters of a remote instance by simplifying the logic involved. When using remote instances you have to validate the arguments they are called with on the server or client before processing them to prevent potentials error from being generated within your code, which can result in some lengthy and messy if statements (depending on the number of expected parameters). Also, in some cases depending on the parameters received you may want to do different things, my module helps to abstract such functionality.




RemoteRequestValidator.New() - creates a new instance
RemoteRequestValidator:AddParam() - creates a new RemoteParam Object for which the sanity callback should be set.
RemoteRequestValidator:Validate(Params) - returns true if all the parameters pass their respective sanity check.

Simple Tutorial

local RemoteRequestValidator = --Require the module

local ExampleRemoteEvent = --a link to some remote event

For this example we expect the remote event to receive three parameters
the first should be a String, the second should be a base part and the 
third one should be a table.

--Creating the Validator:
local ExampleRemoteValidator = RemoteRequestValidator.New()

--Adding the parameters and setting the sanity callback
--The parameters should be added in the same manner they will be processed

--Adding a check for the first expected parameter, a string
    return (Value) and (typeof(Value) == "string")
--Adding a check for the second expected parameter, a base part
    return (Value) and (typeof(Value) == "instance") and (Value:IsA("BasePart"))
--Adding a check for the third expected parameter, a table
    return (Value) and (typeof(Value) == "table")

--Then when connecting the remote event we can simply do

ExampleRemoteEvent.OnServerEvent:Connect(function(Player, SomeString, SomePart, SomeTable)
    if (ExampleRemoteValidator:Validate(SomeString, SomePart, SomeTable)) then
         --checks passed

and you could also easily add some additional sanity checks to the sanity callback function, 
this is just a simple example to explain the api.

Hi there~ @cjjdawg

Thank you for sharing your creation with us, this is very interesting stuff.

Would you kindly create a link to Source code (preferably Github and/or Pastebin) for people who want to read the source but don’t have any access to a PC or maybe want to contribute to the source

Also the explanation isn’t enough to understand and use, could you try changing the OP


He clearly provides an explanation, an API, and examples.


I think he’s referring to explaining it more in-depth, aka explaining what the module does, how it’s better than not having it, etc.

1 Like

He doesn’t really need to do that—it comes with basic understanding of Roblox scripting that you should validate data sent from RemoteEvents, and this library does that. Not every community resource is an ad encouraging people to use it, it’s just a resource should you want to.


Posts in Resources are meant to be useful to the community, not random garbage. (this OP is fine)

I am well aware that you must validate user input and do sanity checks on remotes, I’m not an ammature, that’s not my concern

I want to know exacly how it works, you can’t just put anything foreign into the game and expect everything to work fine, that’s disastrous.

I never put someone elses code into my games unless I know exactly what it does.

His explanation is barely enough to cover what I mentioned in the Thread I linked, you can refer to that.

I should clarify that my concern is HOW to use it, and Not WHY use it

I’ll update the post later today with an example place of the module in action and update the example in the post, thank you for the feedback.

Hello, I would recommend utilizing GitHub over Pastebin as it’s one link vs how ever many scripts you have. Furthermore we can see revision history allowing people to make informed decisions on whether or not to update their version of your script.

It should also be noted that you do not seem to include the “RemoteParam” module in your source code links. Hopefully you decide to look into GitHub!

1 Like

Thank you for the feedback, I do use github so I will update the post with a link to that as well, and the RemoteParam is located at the bottom of the pastebin, but I know its confusing will definitely update later.

1 Like

Whoops! I completely missed that. A link to GitHub would be much appreciated! Thanks for your speedy reply.

1 Like

Require the module and use the API and tutorial he provided. It’s that simple.

I really don’t see the point of it. Not to offend or anything. But I don’t see how this is more streamlined when you can do it in the Connect function with #args amount of if/elseif statements. This module is literally just those if statements but in functions. Here is your example if a normal person would do it:

local event = script.Parent

event.OnServerEvent:Connect(function(plr, string, part, table)
    if typeof(string) ~= "string" then return
    elseif typeof(part) ~= "instance" and not part:IsA("BasePart") then return
    elseif typeof(table) ~= "table" then return end

    -- do your code

I did not like how messy such if statements looked that’s why I create the module, plus my version makes it more readable for me by just combining such statements into one compound statement (I’m also not a huge fan of the if not then return pattern, i find it much easier to read if this then do), and I thought a few other persons may like the idea, but I get its not for everyone. Plus that example was just a simple use case, It can become more useful when needing to perform a lot of sanity checks on the parameters, with my way the module helps to abstract that functionality from the remote connection.

I dont really think he needs to have all of that, just a pastebin and the model link is enough.