Offsetting from humanoid root part is inaccurate and unreliable

  1. What do you want to achieve?
    I want my hitbox to be in a precise and accurate position.

  2. What is the issue?
    When offsetting my hitbox from humanoidrootpart, its cframe is pretty inaccurate sometimes (Mostly messes up when moving or jumping or randomly). When Staying Still When Jumping/Walking/Moving/Sometimes

  3. What solutions have you tried so far?
    I have tried getting the humanoidrootpart before anchoring the humanoidrootpart, and I have looked around the dev forums but can’t find anyone who talks about this.

NOTE: All effects are in a client script from remote events

Server Code:

		local humrp = char:FindFirstChild("HumanoidRootPart")
			humrp.Anchored = true
               -- anim events and stuff
               wait(1)
				local hitbox = Instance.new("Part")
				hitbox.Size = Vector3.new(10,10,10)
				hitbox.Anchored = true
				hitbox.CanCollide = false
				hitbox.Parent = workspace
				hitbox.Transparency = 0.5
				hitbox.CFrame = humrp.CFrame * CFrame.new(0,0,-10)

Is there a reason you’re offsetting its depth by -10??

1 Like

its not the depth it offsets infront

The Z axis is depth, actually.

But back to my question, why do you offset it by -10? That seems like a really big offset, probably why it’s causing inaccuracies.

I don’t really have enough information to help you :confused:

it isnt depth, i tested it at +10 and it makes the hitbox behind the player instead

its not big its because the hitbox is pretty big and it needs offset to make the hitbox infront of the player for the casted attack

image

As seen here, the Z axis is used in 3D games, so it’s used for depth. If you just had the X and Y axis, there would be no depth, hence, 2D.

How are you updating the hitbox’s position? Do you weld it to the player? Or are you updating its CFrame in a loop?

I do not weld the hitbox, its anchored, its cframe is offsetting infront of the player, and stays there, and it works mostly when i stand still, but when jumping or moving it is innacurate sometimes as its supposed to be infront of the player but sometimes its rotation is not infront of the player.

will weling it fix the innacurate rotation?

Are you desiring for it to remain at a constant position during the course of an attack? Or do you want it to move with the player?

so i anchor the player, then i cast an attack offsetting the humanoidrootpart. I want the attack to go offset the position the anchored player is at at that time, but as seen on the inaccurate video it is not accurate. I just want it to be accurate offset and cframe, but in the inaccurate video it shows how its not accurate offsetting from humrp compared to the video where its accurate