Module scripts do not replicate to client, Any alternatives aside from instance values?

So I am making a fighting game and theres a mechanic where players get stunned if they hit a blocking player, The issue is I manage all actions from the client so it is more responsive kinda how First Person Shooters manage the fire rate and hitboxes from the client, I of course run sanity checks within each remote to prevent exploits, So the issue is to store all the weapon’s stats and player stat’s I have been using a module script and I store on this module script a value for the server that the client should also be able to see called IsStunned, The purpose for this value was for the local scripts to check if this was true to prevent doing any action like hitting or charging, and even if they did when they fired the remote it would obviously not do whatever they were trying to do because of server check, But today I was informed module scripts do not replicate data and I dont wanna use a lot of InstanceValues (Like the boolvalues, NumValues the ones that are roblox objects), and I still need to use module scripts since I store all my animation tracks there so other scripts can play the animation track, So does anyone has better alternatives?

1 Like

You can make a remote function to request certain info from the server.
For example:
PlayerStatRequest:InvokeServer(ModuleName, DesiredStat)
Then the server just has to send back the info based on the given parameters.

More info here.

will this yield scripts until it gets the response back from the server? I really dont wanna mess up the responsiveness of the engine.

Yes, since it’s dependent on the response from the server but your server check is also dependent on a response, right?

from what I know reading bool values just reads whatever gets replicated to the client.

Why not try out attributes? They replicate values.

Yeah but they make using data and writing it a hazzle just like BoolValues and stuff.

You can use :SetAttribute(Name,Value)

Well sorry to tell you there really is no way to get information replicated other than methods already stated:

  • Using Remote events / functions
  • Attributes
  • InstanceValues

:sob: im gonna cry now waaaah, Ok then ill use bool values for server data that needs to be read by the client, or fire client.

If you are going to use many booleans I suggest using attributes, they have less data cost because they are under one instance, unlike several instance values. They might be more of a hassle to use but are more performant. (Thought I should add this in case you care about performance.)

I’m aware of this but the difference in data is so small that it woudnt even make a difference in performance and slow me down, also setting attributes for characters sounds like really painfull

:SetAttribute(tostring(PlayerId)..StatName, Value)

I have no idea what is a toe string but thanks anyways im gonna go ise BoolValues and Fire client to code this, Altho my issue will be players lagging and not getting the value replicated causing them to do an action fire a remote and get kicked by the anti cheat