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

This is a simple AI script but .Humanoid says not valid member of script. Does anyone know why?

wait(1)

attack = 5
children = game.Workspace.Dummy:GetChildren()
function hitObject(hit)
	if hit.Parent.Humanoid ~= nil then
		hit.Parent.Humanoid.Heath = hit.Parent.Humanoid.Health - attack
	end
end

for i = 1,#children do
	if children[i].ClassName == "Part" then
		children[i].Touched:connect(hitObject())
	end
end



follow =
 false
human = game.Workspace.Dummy.FindFirstChild("Humanoid")




while true do
	if game.Players.Player1.Character:FindFirstChild("Torso") ~= nil then
		if game.Players.Player1.Character.Torso.Position.X - game.Workspace.Titan.Torso.Position.X <= 10 then
			follow = true
		end
	end
	if follow then
		if game.Players.Player1.Character:FindFirstChild("Torso") ~= nil then
		human.WalkToPoint = game.Players.Player1.Character.Torso.Position
		end
	end
	wait(.5)
end

3 comments

0

what is AI script?

0

Artificial Intelligence it is trying to make the npc follow a human when it gets into 10 units of range like a zombie

2

You forgot to spell "Health" on line 7.

1 answer

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