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

Why is it that Humanoid:MoveTo() will not work for my script?

Asked by 4 years ago

Hello, i am creating a script where when the humanoid is damaged, it walks to the closest player in range. But it isn't working, when everything is correct and where it should walk.

Script:

01local runService = game:GetService("RunService")
02 
03local oldHealth = 75
04 
05local range = 40
06 
07local targetFollow
08 
09local initiate = 0
10 
11script.Parent.Enemy.Changed:Connect(function(plays)
12    local hum = script.Parent.Enemy
13 
14    print(1)
15 
View all 73 lines...

script.Parent.Enemy:MoveTo(targetFollow.HumanoidRootPart.Position, targetFollow.HumanoidRootPart) is the important line

targetFollow is my player, wont work. Please help

1 answer

Log in to vote
0
Answered by 4 years ago

You can go to humanoid and set WalkTo the part you want and make a script that move to block on a specified position ontouched.

Ad

Answer this question