Basically, I’m trying to make the bullet/ray fire exactly where the humanoid root part is stationed when firing, to shoot directly ahead, and it seems to lag behind, I’ve noticed that when I playtest the game it makes a noticeable impact on aiming, and I’d really like to know why it’s doing this (This uses fastcast, by the way)
The specific code used to shoot out the ray in the direction the player
local function fire(player)
if db ~= false then
db = false
local sound = tool.FireSound.Value
workspace.Gun.SoundId = "rbxassetid://"..sound
local origin = tool.Parent.HumanoidRootPart.Position -- here is where the ray originates from
local direction = tool.Parent.HumanoidRootPart.CFrame.LookVector * 500 -- and right here is how the ray calculates the direction.
caster:Fire(origin, direction, 500, castBehavior)
db = true
Here the direction is multiplied by 500, and the distance is 500 too so the direction becomes tool.Parent.HumanoidRootPart.CFrame.LookVector * 250000 I am not sure whether this would cause the issue but this is a very long ray. I believe that you could use remove * 500 when you define direction.
Correct me if I am wrong, I haven’t used FastCast before.