Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
815 views
in Technique[技术] by (71.8m points)

lua - || Getting error while using Humanoid:MoveTo() on roblox

I'm getting an error trying to code a Roblox game i want a walking character that follows me so i put a local script into the dummy and did the following in the script:

while true do
    script.Parent.Humanoid:MoveTo(game.Players.LocalPlayer.Character.HumanoidRootPart.Position)
    wait()
end

-- Local Script is inside of a dummy

As you can see I did a while loop that loops it forever and inside of it I've got the humanoid from inside the Dummy and then did the inbuilt function and for the location, I got the players character and got the humanoid root parts position when I run the script it doesn't do anything nothing shows up in the console the dummy stays in the same position and doesn't move. I don't know how to fix this so please help.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

What is the point of updating the target position of that Humanoid 30 times per second?

From what I found the default wait time is 0.03s. Using very short wait times is generally discouraged.

Pick a reasonable wait time of a few seconds.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...