Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

choosing a random function from module script to script?

I am making an minigame where players spawn on platforms and random events happen, for a platform growing etc. When i start the game i get the error: Workspace.Script:51: invalid argument #2 to 'random' (interval is empty)

Module script:

local Events = {

}

function Events.LargerPlate() local gamestatus = script.Parent.GameStatus local Platforms = workspace.Platforms:GetChildren() local platform = Platforms[math.random(1,#Platforms)]

gamestatus.Value = "Someones platform grew larger!"

for i = 1,10 do
	platform.Size = platform.Size + Vector3.new(0.5,0,0.5)
	wait()
end

end

function Events.Unanchored() local gamestatus = script.Parent.GameStatus local Platforms = workspace.Platforms:GetChildren() local platform = Platforms[math.random(1,#Platforms)]

gamestatus.Value = "Someones platform got unanchored!"
wait(1)
platform.Anchored = false

end

Script:

local events = require(script.EventScript) local event = events[math.random(1,#events)]

1 answer

There are no events in the Events array. The error says it all: "(interval is empty)", which means there's no choice available to pick a random one.

This discussion is preserved as it was. New answers, comments, and votes are closed.