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

Why does the humanoid not walk to the goal?

	
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?

2 comments

0

don't walk* ?

0

Yes

2 answers

✓ Accepted answer

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))

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))

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