You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make my gun enemy ai constantly stare at its target if its with the Awareness value on true
What is the issue? Include screenshots / videos if possible!
Certain functions that do that stop the humanoid from using the MoveTo() ( which is needed since the enemy walks backwards and sideways while shooting at its target )
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
Tried using .lookAt() but it didnt work and can’t find any similar posts other than one talking about using ApplyAngularVelocity(), which i tried.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local HumanoidRootPart = script.Parent.HumanoidRootPart
local target = script.Parent.Target
while wait(0.5) do
if target.Adornee ~= nil then
task.wait(0.1)
for i = 0, 1, 1/20 do
HumanoidRootPart:ApplyAngularImpulse(Vector3.new(target.Adornee.HumanoidRootPart.Position.X, 0))
end
end
end
ApplyAngularImpulse just seems to make him shake a little bit but not turn
You can use the CFrame property of the NPC’s HumanoidRootPart to constantly update its orientation towards the target
For example
local HumanoidRootPart = script.Parent.HumanoidRootPart
local target = script.Parent.Target
while wait(0.5) do
if target.Adornee ~= nil then
local targetPosition = Vector3.new(target.Adornee.HumanoidRootPart.Position.X, HumanoidRootPart.Position.Y, target.Adornee.HumanoidRootPart.Position.Z)
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position, targetPosition)
end
end
I was actually using this before i added strafing and backing off the target ! It works very well if the gun enemy doenst move while shooting but fails when you end up adding more actions to it, it also tends to look up alot making it fall.
This works wonderfully ! I didnt think that adding a larger wait() would make it so it can move for most of the time, other than a few little jitters sometimes its almost not noticeable and works very well for what im doing, and the small jitters make it feel like they’re tripping or something, making them feel a bit more alive ( which is what im aiming for )