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

:IsA returning a nil value?

I have ran into a tricky situation. I am using :IsA() to find anything with the Tool ClassName inside a folder, which is due to multiple tools inside the folder. I do not know what is causing the error.

Output: 15:27:55.917 - ServerScriptService.MainGameScript:290: attempt to call method 'IsA' (a nil value) 15:27:55.918 - Stack Begin 15:27:55.918 - Script 'ServerScriptService.MainGameScript', Line 290 15:27:55.918 - Stack End

Code:

CBBToolsFolder = MinigameTools.ClassicBrickbattle

CBBTools = CBBToolsFolder:GetChildren()

if CBBTools:IsA("Tool") and CurrentMap.MapName.Value == "Classic Brickbattle" then
for i = 1, #Player do
		CBBTools:Clone().Parent = Player[i].Backpack
	end
end

1 answer

✓ Accepted answer

You can't call :IsA() on a table. Here's a fixed code:

CBBToolsFolder = MinigameTools.ClassicBrickbattle

CBBTools = CBBToolsFolder:GetChildren()

for i, v in pairs(game:GetService("Players"):GetPlayers()) do
	for x, y in pairs(CBBTools) do
		if y:IsA("Tool") and CurrentMap.MapName.Value == "Classic Brickbattle" then
			y:clone().Parent = v.Backpack
		end
	end
end

If this helped, please accept!

2 comments

0

It helped! Thanks

0

@ModifiedBlox No problem!

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