Moving parts on the server

So I am currently working on a Tower Defence game and I have come across an issue with tweening the enemy models on the server, you may already know this but tweening using the server is very consuming and would use a lot of data for the server to handle so I though to just tween on the client although I can’t figure out a way to find the position back on the server as just asking the clients (with remote functions) could result in hackers returning a custom value they set…

The question is basically, how can I tween on the clients with the server knowing where the enemies are when it needs them?

1 Like

Why tween the enemies?

But for your problem with what you’re working with there I would just consistently fire remotes telling the enemies where to go (maybe not the best possible solution) and base their position off that with realistic estimates based on how fast the enemy moves, their last position, the target position, the time they were told to start moving, etc you get the idea.

1 Like

I’ll have a look into your solution and try to implement it and look at the usage stats! also I use tweens cause I’m pretty sure walkto or something with the humanoid isn’t reliable, correct me if I’m wrong though cause I’d love to use it.

You could just use Humanoid:MoveTo() and as far I know, it’s just as reliable: documentation

1 Like

I haven’t made a Tower Defence game before but I have used MoveTo a fair few times and am still yet to come across any reliability issues with it.

I genuinely think that you should use MoveTo instead, because tweens seem like a really long detour that just isn’t necessary and is also costly in terms of resources on both the server/clients.

Humanoid:MoveTo(Position)

1 Like

If you use :Lerp() on the server it’s less consuming and then you wouldn’t have to use remote events

1 Like

Okay, if that’s the case then thank you, I think I’ll use move to. I’m pretty sure I assumed it’s unreliable cause I’ve tried using it in the past and sometimes it did what I wanted but also sometimes it didn’t while I hadn’t changed anything, or at least that’s what I thought. I’ll give it another try!

1 Like

Just tried it, works perfect… thanks

1 Like

By the way, if you are using humanoids I recommend disabling some of the humanoid states as it can help with performance, especially if you will have a lot of enemies.
You can disable most states because your enemies will likely not need them in a tower defense.
Docs (SetStateEnabled)

2 Likes

Alright thanks! I’m always looking to optimise and this is really helpful.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.