Is tweening or CFrame better for moving skill parts?

What I’m trying to say is, for example, if I were to make a fireball attack, should I move it by updating the CFrame constantly or should I move it through tweening?

1 Like

Tweening actually does the same thing as CFrame, but handles it automatically in the engine and is slightly faster but less flexible. If your movement can be done with a tween, you should do it that way. Just don’t do manual CFrame changes in a server script, because this will be very choppy as it tries to manually send every update to clients.

1 Like

Both can serve the same purpose, it’s just a matter of what you need out of it or in this case what all you want to do with the fireball. I’d say that inherently, using the CFrame is going to give you a lot more control over what happens and how it happens but it’s also harder and takes more effort to do the same thing. My advice is to stick to the TweenService if you can and only use CFrames if the TweenService isn’t sufficient for what you want to do.

1 Like

You should actually have code in both the server AND the client. The client should be responsible for the visual, moving the fireball on their own screen for the reasons you’ve described however if the hit detection also need to be aware of the fireball’s movement then that should be handled on the server. Hit detection should never rely on the client if you don’t want people to be able hit anyone they want with an exploit (if it’s just like a harmless confetti bomb with a purely visual/fun effect that doesn’t effect competitive gameplay then it’s not something you need to care about).

1 Like

How should I do manual CFrame changes if not on the server? Is there a way to update a CFrame on every client instead? And if so, is that the best thing to do or is there something better to do?

In this case you have to tell each client to start an animation at the same time and then have a client script which does the actual CFrame movement.

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