Real-time slash effects syncing to an animation

Is it possible to sync a slash effect (the CFrame of it) to an animation and how so? Or would you have to inefficiently use hard-coding and manually CFrame it?

What do you mean by sync a slash effect to an animation? Couldn’t you just animate the slash and not have to CFrame anything

How would you animate the animation + a mesh.

1 Like

Do you know what a slash effect is? I’m not trying to connect it to my weapon it’s suppose to be separate and I’m struggling to see how you would change its CFrame to match the animation.

Full honestly, I have no clue what kind of slash effect you’re referring to now. Also what does animate the animation even mean? If you could show an example of that it would be helpful

As you can see the effect is not connected to the weapon and the CFrame of it is not just 1 CFrame but multiple different ones based on the animation.

The slash effect is connected to the weapon using trails. v

No it is not, if you look clearly it’s an expanding mesh.

Ok idk what to tell you man, its literally a trail lol

It literally is not a trail, watch thoroughly and you’ll see that it’s a mesh. Furthermore trails cannot be that precise nor can it be that circular.

My guy, its a trail. Meshes cant have varying transparencies on them. You just cannot make that with a mesh. I’m willing to bet 1m robux its a trail

Have you not heard of textures? Furthermore a trail cannot just generate that in a short amount of time without any movement so i don’t know what you’re on about.

It’s literally a trail dude, don’t ask for help then refuse to actually accept the help

3 Likes

But it literally isn’t a trail you can clearly see the whole effect before it reaches the end of the animation. Also, trails are irrelevant to this topic.

This might just be because the animation is very fast. It’s just an optical illusion.

Okay theoretically this topic was suppose to be based on a mesh rather than a trail so just imagine it’s a mesh okay guys. No trails.

Ok so lets say hypothetically its a mesh (which its not, its a trail) you have two options here. Hardcode the orientation of your mesh with your premade animation slashes. Animations have animation events that you can tag as “slash 1, 2,3 etc” then link the premade orientation of the mesh to the animation event. Then the mesh will rotate and appear when the specific animation marker is hit.

or (idk might not work)
You could try getting the lookVector of the mesh and the direction its headed, then with some trig calculate the angle required for the mesh to turn according to the direction that the sword is headed.

1 Like

The AnimationTrack | Roblox Creator Documentation has an event that tells you when the next keyframe is being played in the animation. So you could place the mesh part every time it reaches a certain keyframe.

local key_frames = 0;
local place_at = 3 --Will play at the 3rd keyframe.

animation_track.KeyframeReached:Connect(function()
key_frames += 1
if key_frames ~= place_at then return end;
local newMesh = mesh_part:Clone(); --Just clone the part that has the mesh in it
newMesh.Anchored = true;
newMesh.CFrame = sword.Handle.CFrame; -- Set to handle's cframe
end);

animation_track.Stopped:Connect(function()
key_frames = 0; --Reset
end);

You could also try welding instead of setting cframe and anchoring. It would also be pretty easy to make a fade effect since you’re using parts.

1 Like

Doesn’t trail follow the exact attachments of the weapon?.. If you pause at the right time you can see that the slash effect is ahead of the weapon so it can’t be a trail, @RatiusRat is correct