Tweening NPC Boss Attack

So in this video the character tweens over to a golem(I’m eventually going to use this code for the golem but it was just easier to use regular character for now)

My problem is that I don’t want the character to change their rotation but anytime I use only the positions (for example goal.Position = HRP.Position) it sends the character up in the air.

Im very confused so please help me out! Much appreciated.

local dummyHRP = game.Workspace.Golem:WaitForChild("HumanoidRootPart")
local goal = {}
goal.CFrame = dummyHRP.CFrame
local LockOn = Ts:Create(script.Parent.HumanoidRootPart,info,goal)
LockOn:Play()

yeah reason this is happening is because you set the goal to golem’s cframe which means the player turns the same direction as the golem, what you might want to do is:

local dummyHRP = game.Workspace.Golem:WaitForChild("HumanoidRootPart")
local goal = {}
goal.CFrame = CFrame.new(dummyHRP.CFrame.Position*script.Parent:GetPivot().Rotation)
local LockOn = Ts:Create(script.Parent.HumanoidRootPart,info,goal)
LockOn:Play()

Workspace.Dummy.AI:11: invalid argument #1 (CFrame expected, got Vector3) I got this error

Btw I know why the dummy is rotating to the golems cframe. My problem is that when I use something like HRP.Position it shoots the character up in the air

I probably should have tested the code before i gave it to you, try this:

local dummyHRP = game.Workspace.Golem:WaitForChild("HumanoidRootPart")
local goal = {}
goal.CFrame = CFrame.new(dummyHRP.CFrame.Position) * script.Parent:GetPivot().Rotation
local LockOn = Ts:Create(script.Parent.HumanoidRootPart,info,goal)
LockOn:Play()

Tell me how that goes

thank you that worked. Could u explain what that line of code does? Thank you again

the position is probably in the air then, you’ll have to make sure you fix it so it’s not

what do you mean by “the position is probably in the air”?

im confused, sorry. What part of the code needs to be fixed? For what I gave you all i did was change the end goal so that the cframe was the position of the golem and the original direction the dummy was facing

That is all that needed fixing bro :slight_smile: It just left my brain that u could do that lol

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.