Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited by User#5423 4 years ago

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

0
Can you please post your code in the proper code manner so I can take a proper look? SilentsReplacement 468 — 4y
0
what is that ? :D GranderCZ 0 — 4y
0
im new at scripting :) GranderCZ 0 — 4y
0
where i can find/post it ? GranderCZ 0 — 4y
View all comments (4 more)
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. sahar1213 72 — 4y
0
i dont have the 6th line this is full script GranderCZ 0 — 4y
0
the 6 line is the source[n.Tag.value]= n GranderCZ 0 — 4y
0
edit:- code block User#5423 17 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

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.

Ad
Log in to vote
0
Answered by
Filipalla 504 Moderation Voter
4 years ago

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

Answer this question