i want to know the best/most performant way of moving a mob through waypoints
I watched the gnomecode video about it but then i searched more about it and apparently using humanoids is bad? im not sure how bad it truly is but i saw that tweenservice is better which i tried but it ended up being weird
The expected behavior is it would be like MoveTo except it just ended up looking like it was teleporting with tweenservice
and same question for towers how would you rotate them to be facing the enemy on the client
If you want it to smoothly rotate to look at the target you could look at tweening the CFrame or using AlignOrientation/various joints/motors to achieve similar results, although if you wish to use motors/joints built-in smoothing methods then I believe youâll need to work in angles which takes a bit more math.
Is there a reason why it has to be run on the client? This code should function client-side so long as youâre fine with no replication to other clients/server. If you want replication you could experiment with setting the network owner of the turret to the client and modifying the CFrames that way?
Itâs depends on what youâre trying to achieve.
Ah I think I understand now. Assuming this is single-player and you intend on running the physics on the client:
TweenService was a good idea. You can remove the humanoid entirely and use an AnimationController to make the walking animation. Tween duration needs to be a function of the distance between the two points: Duration = Distance / WalkSpeed. For each straight length of path, youâll need your own tween, with potentially other tweens at each âcornerâ to handle rotation unless you want your NPCs drifting through each corner. Utilise the .Completed event of each tween to know when to activate the next one. You can do all of this in a LocalScript on the client.
If progress and such is being saved and used in a leaderboard-type situation then you can update the server script with progress via remotes. If youâre concerned about exploiters, itâs a potential weakness of this system, but equally most exploits/exploiters wonât be advanced enough to abuse it so long as youâre smart with the type of information youâre sending over as well as sanity checking on the server to make sure. My point about network ownership may still benefit you as well. If you create your npcs on the server, set their network ownership to the client, then have the client tween the npc, then that movement should be replicated to the server. In that case then youâll be able to handle the turret logic server-side or client-side (whichever you decide).
If you still wish to use humanoids, make sure youâre disabling as many unnecessary states as possible to free up some of the internal processing that the Humanoidâs controller is doing in the background.