Hi, so I have made an AI that shoots people. As you can see in the video, everything works, but I have one problem. The bullets only hit when I am standing still or facing the AI. If I am walking or jumping, the bullet wont hit me, how can I fix this?
(Ignore the animations btw, they are WIP, and I dont have a gun model yet)
Here is the script:
local bullet = Instance.new("Part",workspace)
bullet.Size = Vector3.new(0.2,0.2,0.3)
bullet.BrickColor = BrickColor.new("White")
bullet.Material = Enum.Material.Neon
bullet.CFrame = Bot:FindFirstChild('Right Arm').CFrame
bullet.CanCollide = false
bullet.Touched:Connect(function(obj)
if not obj:IsDescendantOf(script.Parent) then
local human = obj.Parent:FindFirstChild("Humanoid")
if human then
if obj.Name == "Head" then
human:TakeDamage(100)
else
human:TakeDamage(math.random(30,40))
end
end
bullet:Destroy()
end
end)
bullet.CFrame = CFrame.new(Bot:FindFirstChild('Right Arm').Position, target.Position)
bullet.Velocity = bullet.CFrame.lookVector * 700
```
If you have any suggestions, let me know. Thank you

I think it’s because your movement is always changing, so the bot is always delayed when it decides to shoot the bullet. Basically by the time the bot finds your position and shoots, your already moved up. can you show your code where you detect the players position.
Yeah I saw that, but where do you get that target value, you might have something that delays your code that doesn’t allow your target value to always stay upto date so the bullet can hit the players current position