Getting this weird error when I use math.random, and there doesn’t seem to be many solutions on the DevForum. This might be an oversight on my part, if you have any solutions or work arounds please let me know.
local Lobby = workspace:WaitForChild("Lobby")
local KeyAssets = Lobby:WaitForChild("KeyAssets")
local NPC_Locations = KeyAssets:WaitForChild("NPC_Locations")
local function RandomSeat(NPC)
local GetNPCLocations = NPC_Locations:GetChildren()
local RandomWoodenStool = NPC_Locations[math.random(1, #GetNPCLocations)] --// error happens here
local Occupied = RandomWoodenStool:GetAttribute("Occupied")
if Occupied == true then
RandomSeat()
else
Occupied = true
local Seat = RandomWoodenStool:FindFirstChildOfClass("Seat")
CalculatePath(NPC, Seat.Position)
end
end