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

Weird For Loop Timeout Error (Possible Engine Bug?)

Before I ramble on about this, I asked around in the Scripting Helpers Discord, and I had a few people mention this might be a Engine bug as this should not be timing out. When I first scripted this about 2 weeks+ back, it worked 100% flawlessly, now that I come back to work on it, I'm getting this timeout error.

Anyways, about the script, It's a simple player join script. Under the join script I have all the values I need it to create, since I'm creating a form of a tech tree for my game, and a resources folder. Hard to explain, but this picture would better represent. You'd also need to see the image to somewhat understand the code. I know there's other ways to do this better, but I just want to do this my way, you know? Image

I'm not sure how to further explain this, so here's the code. It times out on line 90, which would be the second for loop.

	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = plr
	
	local Cash = Instance.new("IntValue")
	Cash.Name = "Cash"
	Cash.Parent = leaderstats
	
	local TechTree = Instance.new("Folder")
	TechTree.Name = "PlayerTechTree"
	TechTree.Parent = plr
	
	local Resources = Instance.new("Folder")
	Resources.Name = "PlayerResources"
	Resources.Parent = plr
	
	for _,v in pairs (script.TechTree:GetChildren()) do
		local a = v:Clone()
		a.Parent = TechTree
	end
	
	for _,v in pairs (script.Resources:GetChildren()) do
		local a = v:Clone()
		a.Parent = Resources
	end

1 answer

Update, I fixed it. I simply just rewrote the a.Parent = TechTree (and the other one) to a.Parent = plr.PlayerTechTree and plr.PlayerResources. I however still wander if this is a engine bug, since, as I stated, worked flawlessly before.

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