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

Why does my script not load any models or maps from ReplicatedStorage?

I'm trying to make a map loading script in Roblox Studio but it doesn't load any of the map models. There are no errors popping up in the output. What do I do?

while true do
	local number = math.random(1,3)
	wait(5)
	game.ReplicatedStorage:FindFirstChild("map"..number).Parent = game.Workspace
	wait(5)
	game.Workspace:FindFirstChild("map"..number).Parent = game.ReplicatedStorage
end

1 answer

✓ Accepted answer

instead of directly setting their parent to workspace, you clone them then set the clone's parent to the workspace. Here is the script to do that

while true do
	local number = math.random(1,3)
	local mapClone = game.ReplicatedStorage:FindFirstChild("map"..number):Clone()
	wait(5)
	mapClone.Parent = game.Workspace
	wait(5)
	game.Workspace:FindFirstChild("map"..number).Parent = game.ReplicatedStorage
end

If it doesn't work, please do use the developer console (F9) and look for any errors regarding the script as it can help me understand why the script doesn't work

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