Roblox won't create a folder through ModuleScript

I’m not even sure if this is a studio bug or not.
I have a generation system that makes sure all of the parts I need are stored in ServerStorage and creates a new folder named TiledRooms.

It was working perfectly fine, I was using a button to call the module for the first time which would execute the modulescript for the first time and do the thing above. Now after I updated it stopped working???

local room = {}
room.random = Random.new()
local tileCount = 0
local tileSize = 0

local _t = Instance.new("Folder") --THIS
_t.Parent = workspace
_t.Name = "TiledRooms"

local Pts = workspace.Pts
Pts.Parent = game:GetService("ServerStorage")

local GbranchOffProbability = 0.04
local GlobalSameTileTypeProbability = 0.4
local tilePlacedSuccessfully = false
local endTilePlaced = false

local HasToBranch = {}
local HB_RoomCount
local specialLineageAdded = false

A temporary fix is to add the folder before running the game but like it worked fine before…?

Literally no information is provided.
What do you expect us to just casually read your brain impulses or what?

right, sorry. ill attach some videos too. player gets removed too. ill add more stuff, one sec

Maybe provide more of the code and how exactly it works?

This is the code that actually starts up the animations/spawning.

local module = {}

local currentround = 0

local initialSetup = script.RoundSetup
initialSetup.Parent = workspace
initialSetup.Enabled = true

local function SpawnLevel()
	local x = require(game.ReplicatedStorage.TileModules.RoomManager)
	local size = 50 + currentround * 15 + math.random(-10, 10)
	return x.AddTile(size, Vector3.new(600, 200, -5.8))
end

local function SpawnAnimation()
	local TS = game:GetService("TweenService")
	local rs = game:GetService("ReplicatedStorage")
	local eventFind: RemoteEvent = rs:WaitForChild("GuiEntryEvent")
	local event: RemoteEvent
	if not rs:FindFirstChild("CamAnim") then
		event = Instance.new("RemoteEvent")
		event.Name = "CamAnim"
		event.Parent = rs
	else
		event = rs.CamAnim
	end
	
	local function Music()
		local tpm = script.TeleportMusic
		tpm["Wind fall"].Volume = 0; tpm["Wind fall"]:Play(); tpm["Wind fall"].PlaybackSpeed = 0.4;
		TS:Create(tpm["Wind fall"], TweenInfo.new(5), {Volume = 1.4}):Play()
		TS:Create(tpm["Wind fall"], TweenInfo.new(16.3), {PlaybackSpeed = 4}):Play()
		for _, v in tpm.Ambiances:GetChildren() do
			v.Volume = 0; v:Play();
			TS:Create(v, TweenInfo.new(0.2), {Volume = 0.95}):Play()
			task.wait(0.1)
		end
		task.wait(5)
		tpm.Screeching[math.random(1, #tpm.Screeching:GetChildren())]:Play()
		task.wait(5)
		tpm.JustScreaming:Play()
		TS:Create(tpm.JustScreaming, TweenInfo.new(6), {Volume = 0}):Play()
		task.wait(3)
		TS:Create(tpm["Wind fall"], TweenInfo.new(2), {Volume = 0}):Play()
		task.wait(3); tpm["Wind fall"]:Stop();
		for _, v in tpm.Ambiances:GetChildren() do
			v:Stop();
		end
		for _, v in tpm.Screeching:GetChildren() do
			v:Stop();
		end
		tpm.Fall:Play()
		task.wait(0.15)
		tpm["Body Fall"]:Play()
		task.wait(0.15)
		for _, v in tpm.FallenAmbiance:GetChildren() do
			v.Volume = 1; v:Play();
			task.wait(0.15)
		end
	end
	
	event:FireAllClients(16.5)
	eventFind:FireAllClients(script.WhiteThing, 16)
	Music()
end

local function FastSpawnAnimation()
	local TS = game:GetService("TweenService")
	local rs = game:GetService("ReplicatedStorage")
	local eventFind: RemoteEvent = rs:WaitForChild("GuiEntryEvent")
	local event: RemoteEvent
	if not rs:FindFirstChild("CamAnim") then
		event = Instance.new("RemoteEvent")
		event.Name = "CamAnim"
		event.Parent = rs
	else
		event = rs.CamAnim
	end

	local function Music()
		local tpm = script.TeleportMusic
		tpm["Wind fall"].Volume = 0; tpm["Wind fall"]:Play(); tpm["Wind fall"].PlaybackSpeed = 0.4;
		TS:Create(tpm["Wind fall"], TweenInfo.new(5), {Volume = 1.4}):Play()
		TS:Create(tpm["Wind fall"], TweenInfo.new(6.3), {PlaybackSpeed = 4}):Play()
		for _, v in tpm.Ambiances:GetChildren() do
			v.Volume = 0; v:Play();
			TS:Create(v, TweenInfo.new(0.2), {Volume = 0.95}):Play()
			task.wait(0.1)
		end
		task.wait(1)
		tpm.Screeching[math.random(1, #tpm.Screeching:GetChildren())]:Play()
		task.wait(1)
		tpm.JustScreaming:Play()
		TS:Create(tpm.JustScreaming, TweenInfo.new(6), {Volume = 0}):Play()
		task.wait(1)
		TS:Create(tpm["Wind fall"], TweenInfo.new(2), {Volume = 0}):Play()
		task.wait(3); tpm["Wind fall"]:Stop();
		for _, v in tpm.Ambiances:GetChildren() do
			v:Stop();
		end
		for _, v in tpm.Screeching:GetChildren() do
			v:Stop();
		end
		tpm.Fall:Play()
		task.wait(0.15)
		tpm["Body Fall"]:Play()
		task.wait(0.15)
		for _, v in tpm.FallenAmbiance:GetChildren() do
			v.Volume = 1; v:Play();
			task.wait(0.15)
		end
	end

	event:FireAllClients(6.5)
	eventFind:FireAllClients(script.WhiteThing, 6)
	Music()
end

local function addTablet ()
	game.ReplicatedStorage.AddTab:FireAllClients()
	game.ReplicatedStorage.foundRoomsReset:FireAllClients()
end

function module.TPPlayers()
	game:GetService("ReplicatedStorage").MainGui:FireAllClients(false)
	task.spawn(function()
		SpawnLevel()
	end)
	task.wait(5)
	local rm : Model = game.Workspace.TiledRooms:FindFirstChild("StartRoom0")
	local newAnimThing = game:GetService("ReplicatedStorage"):FindFirstChild("FallAnimPt"):Clone()
	newAnimThing.Parent = rm
	newAnimThing:PivotTo(rm:FindFirstChild("UniPart").CFrame)
	newAnimThing:FindFirstChild("Script").Enabled = true
	for _, v in game.Players:GetChildren() do
		if v.Character then
			local hum = v.Character:FindFirstChild("HumanoidRootPart")
			if hum then
				hum.Anchored = true
				task.spawn(function()
					hum.CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 1000, 0)
					game:GetService("TweenService"):Create(hum, TweenInfo.new(16, Enum.EasingStyle.Quad, Enum.EasingDirection.In), 
						{CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 0.75, 0)}):Play()
					task.wait(14)
					hum.Anchored = false
				end)
			end
		end
	end

	task.spawn(function()
		SpawnAnimation()
		newAnimThing:Destroy()
		game:GetService("ReplicatedStorage").MainGui:FireAllClients(true)
		addTablet()
	end)
end

function module.FastSpawn ()
	game:GetService("ReplicatedStorage").MainGui:FireAllClients(false)
	task.spawn(function()
		SpawnLevel()
	end)
	task.wait(5)
	local rm : Model = game.Workspace.TiledRooms:FindFirstChild("StartRoom0")
	local newAnimThing = game:GetService("ReplicatedStorage"):FindFirstChild("FallAnimPt"):Clone()
	newAnimThing.Parent = rm
	newAnimThing:PivotTo(rm:FindFirstChild("UniPart").CFrame)
	newAnimThing:FindFirstChild("Script").Enabled = true
	for _, v in game.Players:GetChildren() do
		if v.Character then
			local hum = v.Character:FindFirstChild("HumanoidRootPart")
			if hum then
				hum.Anchored = true
				task.spawn(function()
					hum.CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 500, 0)
					game:GetService("TweenService"):Create(hum, TweenInfo.new(6, Enum.EasingStyle.Quad, Enum.EasingDirection.In), 
						{CFrame = rm.PrimaryPart.CFrame * CFrame.new(0, 0.75, 0)}):Play()
					task.wait(6)
					hum.Anchored = false
				end)
			end
		end
	end

	task.spawn(function()
		FastSpawnAnimation()
		newAnimThing:Destroy()
		game:GetService("ReplicatedStorage").MainGui:FireAllClients(true)
		addTablet()
	end)
end

return module

– IN STUDIO

– IN CLIENT

Ok i might be wrong, but make sure you’re requiring it from another server script or it might not run at all

Like so:

local Module = require(game.ServerScriptService.Module)

This probably isnt the issue if the rest of the script is working, but im just throwing it out there

I figured it out randomly while I was taking a break from the internet. It’s the setup script that runs at start.

local initialSetup = script.RoundSetup
initialSetup.Parent = workspace
initialSetup.Enabled = true

my genius deletes everything in workspace including the player and the folder. Before it didn’t and roblox probably patched it themselves this latest update to studio or something.
:sob:

i guess i was overworked because its such an obvious answer

1 Like

Lol its fine, it happens to the best of us :slight_smile:

One time my script wasnt working and it was because i accidentally added one extra “end”

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.