Attacking With Pet

So i have a hitbox attached to my pet and I want it to move 10 studs forwards to detect enemy. How and where should i do this?

1 Like

Assuming you’re using constraints (which you should be), have the constraint be offset a bit then use a raycast.

If you’re not using a constraint it becomes a whole lot trickier but still doable.

If i did that then it would make the physics not matter. Example , the pet is on top of a house and after 3 studs they fall down , the raycast would still be up there (right now im using weld constraints and .Touched to detect collisions)

You could be using RocketPropulsion instead.

to make the hitbox attach to the pet?

More so to get a pet to a specific location and orientation to use a raycast.

No i use a BodyPosition to move the pet , and use a weld constraint to weld the hitbox onto the pet.

Raycasts wouldnt work since they dont update based on the pets movement , and if i fired them over and over again it would be more resource intensive then just using a .Touched

Might not even be necessary given the fact you can set CollisionFidelity to say ‘Box’ or something and disable collisions for that specific instance.

At this point we aren’t even talking about scripting.

no my issue is , should i move the pet on the server or client?

Not exactly intensive, but more so delayed because of the server being a server (network lag).
Waiting a second then firing a raycast should be enough.

If the pet is used for damaging others, you probably should move it on the server.
But for general movements where the pet just wanders around you can probably do it locally.