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

Why does the humanoid not walk to the goal?

Asked by 5 years ago

This question has been solved by the original poster.

local Humanoid = script.Parent.Humanoid local Torso = script.Parent.Torso local goal = game.Workspace.Goal local model = script.Parent wait(5) Humanoid:MoveTo(goal.Position) local cframe = model.PrimaryPart.CFrame model:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(-90), 0))

I want the humanoid to move to the goal after 5 seconds, then i want to humanoid to turn 90 degrees. What the humanoid does is turning 90 degrees , it does not walk

while if i put this part of the script away:

local cframe = model.PrimaryPart.CFrame 

model:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(-90), 0))

it works again. How can i make a humanoid move and then turn 90 degrees properly?

0
don't walk* ? ErtyPL 129 — 5y
0
Yes BaconX112X 75 — 5y

2 answers

Log in to vote
1
Answered by
thesit123 509 Moderation Voter
5 years ago

There are variables that are unnecessary for right now, but here is my fixed code:

and all you need was to add Vector3.new


local Humanoid = script.Parent:WaitForChild("Humanoid") local goal = workspace:WaitForChild("Goal") local cFrame = script.Parent:GetPrimaryPartCFrame() wait(5) Humanoid:MoveTo(Vector3.new(goal.Position)) model:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(-90), 0))
Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

I fixed it i put a wait in between ~~~~~~~~~~~~~~~~~ local Humanoid = script.Parent.Humanoid local Torso = script.Parent.Torso local goal = game.Workspace.Goal local model = script.Parent wait(5) Humanoid:MoveTo(goal.Position)

    wait(1)

local cframe = model.PrimaryPart.CFrame

model:SetPrimaryPartCFrame(cframe * CFrame.Angles(0, math.rad(-90), 0))

~~~~~~~~~~~~~~~~~

Answer this question