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

How to get a humanoid to WalkToPoint relative to its rotation?

Asked by 4 years ago

For example when I press W I want it to WalkToPoint in the direction that the characters HumanoidRootPart is facing. I tried using CFrame but it says that it WalkToPoint requires Vector3. Here's an example of the code I'm currently using, it makes it walk in the same direction regardless of it's rotation.

    plr.Character.Holder:FindFirstChild("Plague Golem").Humanoid.WalkToPoint = Vector3.new(0,0,99999)
0
Are you trying to have the player itself walk in the direction of it's own HumanoidRootPart or are you trying to have the player have the ability to control a humanoid? ryan32t 306 — 4y
0
if my answer helped, please accept the answer so i can receive reputation. Thank you! :D ryan32t 306 — 4y

1 answer

Log in to vote
0
Answered by
ryan32t 306 Moderation Voter
4 years ago

It sounds like you're trying to move another humanoid so it follows whatever movements the Local Player's Humanoid does.

Here's a script that accomplishes that:

local plr = game.Players.LocalPlayer
-- defining plr
local char = plr.Character
-- defining char
local humanoid = char.Humanoid
-- defining humanoid
local controlledHumanoid = workspace.Dummy.Humanoid
-- defining the controlledHumanoid
repeat
-- repeat loop
wait()
-- wait
controlledHumanoid.TargetPoint = humanoid.MoveDirection
-- setting controlledHumanoid's TargetPoint to the direction of movement from Local Player
controlledHumanoid:Move(workspace.Dummy.Humanoid.TargetPoint)
-- making to controlledHumanoid Move to it's own TargetPoint
until true == false
Ad

Answer this question