Im making a TD game and my script is not working when the npc in touching the tower
Here is the code:
script.Parent.Touched:Connect(function()
if script.Parent.Name == "Enemy" then
print("HI")
end
end)
what is wrong with the script?
Im making a TD game and my script is not working when the npc in touching the tower
Here is the code:
script.Parent.Touched:Connect(function()
if script.Parent.Name == "Enemy" then
print("HI")
end
end)
what is wrong with the script?
Can you maybe show a picture of the npc in the game-explorer?
If that code is for the tower, then it’s checking if the tower is an enemy, use the return of Touched
, which is the part that touched the other part
script.Parent.Touched:Connect(function(hit)
if hit.Parent.Name == "Enemy" then
print("HI")
end
end)