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

ServerScriptService.Scripts.Testing:6: attempt to index field 'Tag' (a nil value) any help?

i have this script:

local enemyai=require(game.ServerScriptService.Module.Classes.Enemy.EnemyAi)

local source = {}

for _,n in pairs{workspace.Course.Paths:GetChildren()}do
	source[n.Tag.Value]= n
end

source["StartingPoint"] = workspace.Course.Other.StartPath

enemyai:StartEnemy(source,"Regular")

and it is not working and saying "ServerScriptService.Scripts.Testing:6: attempt to index field 'Tag' (a nil value)"

8 comments

0

Can you please post your code in the proper code manner so I can take a proper look?

0

what is that ? :D

0

im new at scripting :)

0

where i can find/post it ?

0

you have posted 5 lines of the code, the error is in line 6, we cant help you if you won't post that.

0

i dont have the 6th line this is full script

0

the 6 line is the source[n.Tag.value]= n

0

edit:- code block

2 answers

A few suggestions to checkout:

Is every child of Paths a Tag? If not you need to add a check.

Make sure the names are correct. (Paths, paths, and Path are not equal)

Are the tags created dynamically? You might need to add a wait().

Also if Tags are local and the script is a server one you can have this problem.

I have had all of these issues which result in a ____ is nil.

The error means that n doesn't have a child called Tag, I can't really help you more than that as I don't know your hierarchy

Don't forget to mark my solution as the answer and upvote it if it solved your problem :)

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