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)"
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 :)