I’m trying to get a module to go off and change the variable for multiple scripts for a touch event.
Currently, I’m only using the module with one other script. When I touch the object for the touch event I get "Infinite yield possible on "ServerScriptService:WaitForChild(“GameModule”)
Current Module
local GameModule = {}
local GAME_ACTIVE = false
local GAME_START = game.Workspace.GameStart
GAME_START.Touched:Connect(function()
GAME_ACTIVE = true
end)
GameModule.StartGame = function ()
if GAME_ACTIVE == true then
wait(30)
return GAME_ACTIVE
elseif GAME_ACTIVE == false then
return GAME_ACTIVE
end
end
return GameModule
Current script using it (Not full script, can add more if needed) This script is in a meshpart.
local BlockWait = 0
local GameModule = require(game.ServerScriptService:WaitForChild("GameModule"))
local GAME_ACTIVE = GameModule.DropLayers()
while GAME_ACTIVE == true do
FallEvent = math.random(0,1)
RiseEvent = math.random(0,4)
BlockWait = math.random(0,10)
if FallEvent == 0 then
wait(BlockWait)
model.BrickColor = BrickColor.new("Crimson")