I have a module script in ReplicatedStorage that holds data about the hurricane a server script generates. The module's code looks something like this:
data.HurricaneActive = false data.HurricaneName = "" data.HurricanePath = 0 data.HurricanePosition = Vector3.new() data.AverageWindspeed = 0 data.WindDirection = "" data.StormDamage = 0
And it is located in ReplicatedStorage. Every time a new hurricane is generated, a Server script will update these values. I then have a client check as so:
local ReplicatedStorage = game:GetService("ReplicatedStorage") local dataStorage = require(ReplicatedStorage:WaitForChild("WeatherData")) while true do if dataStorage.HurricaneActive == true then -- Some code to update TextLabels else -- Some more code to update TextLabels end wait() end
However, it does not appear to be replicating. All the values will stay as their defaults, without change. Is there any easy solution? All the code to my game so far revolves around this concept, with the module as the middle man. Help?
instead of using a ModuleScript try using good old value objects (StringValue, BoolValue, IntValue, Vector3Value). if these are put in the ReplicatedStorage you should get the results you're looking for. if i'm correct, ModuleScripts have their own scope according to their caller, in other words, values set in a ModuleScript in the server will replicate to other server scripts but not client scripts. I believe this is true for the client as well.