Way to spawn parts on server side faster or way to use GetTouchingParts() server side on a locally spawned part?

Hello,
I am currently making hitboxes and ran into a problem. At first I was spawning hitboxes on the server because it was way more secure and easier to handle them, no remote events were needed which meant I didn’t have to worry about security. Problem is that when spawning parts on the server there is a bit of delay in when it actually spawns in. Which means if a players is moving while a hitbox spawns, it wont spawn right in front of them, but off to the side/back/front depending which way they would be moving because of the delay. I was wondering if there was any way to spawn a part on the server faster or would I have to use a local script to spawn it in for no delay. Also I was wondering if I could use GetTouchingParts() on the server side even if the part was spawned from a local script (I would think this is not possible to do as the server doesn’t know about the part since it was not replicated to the server). Would Region3’s have any delay in them spawning server side?

1 Like

Hello,

One thing you could try is copying the line of code that sets the position of the hitbox, and add it at the very end of the function. If you are then welding the instance to the player, just set the Part0 and Part1 arguments after the last position value, but create the weld instance before you define the position of the Hitbox.

Let me know how it goes!

I already had the position at the end of the part spawning, but had not tried welding the hitbox to the player yet. I will surely try that, thanks.

Hello,

That will be your issue. If the player moves and it is not welded, then the object will not move. (Unless Anchored is set to false)

Let me know how it goes!

To my surprise the welding the part made the part spawn right in front of the player and had none of the delay effect. At first I was questioning it because if I spawned in the part, which would still have that spawn delay to it, I thought it would weld to the player from the delayed spot, but it seems to go right in front of the character. Thanks for your help.