#Ability position delayed

1 messages · Page 1 of 1 (latest)

little chasm
#

This ability system has no delay between pressing ability key and casting the ability but position where the ability spawns is behind, so for example when I walk forward then ability spawns behind me and if I walk to the left then ability is slightly on my right.
This is not a server latency issue.
Yes I used ai and it cant fix the issue.

#
local HitboxUtil = {}

-- Creates a visible hitbox part, calls onHit for each humanoid hit, then cleans up
function HitboxUtil.CreateHitbox(params)
    -- params: {CFrame, Size, Duration, Creator, OnHit}
    local part = Instance.new("Part")
    part.Anchored = true
    part.CanCollide = false
    part.CanQuery = false
    part.CanTouch = true
    part.Size = params.Size or Vector3.new(4,4,4)
    part.CFrame = params.CFrame
    part.Transparency = 0.3
    part.Color = Color3.fromRGB(255,0,0)
    part.Material = Enum.Material.ForceField
    part.Name = "AbilityHitbox"
    part.Parent = workspace

    local touched = {}
    part.Touched:Connect(function(hit)
        local humanoid = hit.Parent and hit.Parent:FindFirstChild("Humanoid")
        if humanoid and not touched[humanoid] and humanoid.Parent ~= params.Creator then
            touched[humanoid] = true
            if params.OnHit then
                params.OnHit(humanoid)
            end
        end
    end)

    task.delay(params.Duration or 0.2, function()
        if part then part:Destroy() end
    end)
    return part
end

return HitboxUtil

#

delay is always the same

little chasm
dire nacelle
#

Its called client-server delay

fair fieldBOT
#

studio** You are now Level 7! **studio

dire nacelle
#

😭

little chasm
#

I have 1000 ping

#

so it should be delayed by 1 second

#

but it is delayed by it looks like 1 tick

dire nacelle
#

Dude

little chasm
#

so few miliseconds

dire nacelle
#

😭

little chasm
#

?

dire nacelle
little chasm
#

everything is instant except for the position

#

I once put it on server side and then there was hige delay but now the delay is very short

#

but it still exist and idk how to fix that

little chasm
fair fieldBOT
#

studio** You are now Level 2! **studio

sweet raft
#

Just change the spawning distant a slightly forward