Remote event extreme lag

Hello. I have a attack centered game, and I’m having a problem with remote events. Here’s a video to explain:

As you can see, there is extreme lag in the attack. How do I prevent that? When you click, a script sends a request to the server, then that script fires a specific bindable event to a separate script devoted
to that attack. Is that a good way to script it? Will that cause lag?

Convert the video to a .mp4.

1 Like

Did you convert it to a .mp4?

I didn’t do it right, give me a moment.

Weird, the video isn’t playing correctly… I’ll just explain it, when I use the attack, the shard doesn’t start on me, it starts behind me, I’m assuming that’s because that where the server THINKS I am, but if so, how do I decrease the lag?

Hmm. Are you sure its about lag? Try checking where its created. Also, if that isn’t the case, maybe you can try setting the shard part to the client to handle so theres little to no lag. Use :SetNetworkOwnership() to the player. I don’t know much about this network ownership stuff but you get the idea lol. If you want to learn more about this and how to actually set it on the players client, click Network Ownership | Roblox Creator Documentation

I won’t set the ownership to the player because that would make it easily exploitable. My principles are security > performance, not the other way around.

1 Like

Then I would say try checking your part in your script that creates the shard and sets its position. It is very unusual for the shard to start way back or a little back unless its messed with the script.

Weird, it’s still occuring. I’m simply setting the position of the shard to the position of the humanoidrootpart. If that’s where the serverscript thinks the player is, what am I supposed to do about that?

Yeah, you’ll need it to look like that if you want security.

Agh, I was hoping this was fixable. Thanks for the help.

1 Like

Also, I forgot to say, do this to the part you’re shooting:

part:SetNetworkOwner()
--this works the same but you'll see lots of people do it
part:SetNetworkOwner(nil)

This will make the part have a bit of a delay but people won’t be able to exploit and teleport the part to people.

– rewriting, apologies, got it backwards. its 2am

send a position through the remote event to the server rather than have the server fire from the player’s position server-sidedly.

This will work but it would allow anyone to set the position to whatever they want

Okay, I’ll do that. I will add something on to it, too.