how do I fix that?
idk how to do lag compensation without teleporting
the red forcefield is hotbox
I need it to spawn in front of client (now it spawns in front of player from server's perspective)
hitbox function
-- 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
I tried adding location to that function but that didnt change anything
it used server location even tho I used remote events
** You are now Level 1! **