Hi, I’ve recently started messing around with ModuleScripts and have ran into an issue -
I create Values in my MainModule script which are then transferred and adjusted throughout all of the ModuleScript’s in use; however, there is one part where the Values argument is sent through a RemoteEvent to the Client. Upon doing this, I’m unable to call any of the Values from my MainModule even to Read them as they come up as a ‘Nil’ value.
Can anyone recommend a work-around? Was hoping to edge away from physically creating new values in-game.
Below is the code used when the LocalScript requires the module:
local System = { }
function System.FlightControl(Transfer, FlightUI)
System = Transfer
PilotSeat = System.Interior["PilotSeat"]
CurrentPilot = game:GetService("Players").LocalPlayer
local TiltY, TiltZ = System.Exterior:WaitForChild("Root").Orientation.Y, 0
while PilotSeat.Occupant do wait()
if System.Configuration.isWarping.Value == false then
if PilotSeat.Throttle == -1 then
System.BodyMovers["BodyVelocity"].Velocity
= System.Exterior["Root"].CFrame.LookVector * -50/2
elseif PilotSeat.Throttle == 0 then
System.BodyMovers["BodyVelocity"].Velocity
= System.Exterior["Root"].CFrame.LookVector * 0
elseif PilotSeat.Throttle == 1 then
System.BodyMovers["BodyVelocity"].Velocity
= System.Exterior["Root"].CFrame.LookVector * 50
end
if PilotSeat.Steer == -1 then
TiltY = TiltY + 1
if TiltZ == 25 then
else
TiltZ = TiltZ + 1
end
elseif PilotSeat.Steer == 0 then
if TiltZ == 0 then
elseif TiltZ > 0 then TiltZ = TiltZ - 1
elseif TiltZ < 0 then TiltZ = TiltZ + 1
end
elseif PilotSeat.Steer == 1 then
TiltY = TiltY - 1
if TiltZ == -25 then
else
TiltZ = TiltZ - 1
end
System.BodyMovers.BodyGyro.CFrame = CFrame.Angles(0, math.rad(TiltY), 0) * CFrame.Angles(0, 0, math.rad(TiltZ))
end
else
end
end
end