Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a lightsaber cutting/melting effect?

I've seen it in many roblox lightsaber games, you swing across the wall with a lightsaber and it leaves a glowing stripe on the wall. I've been working on making my own lightsabers lately and wanted to add this effect too, I have tried a few methods of me but they worked out really ugly or not working.

One of my ideas was making small parts in a row along the blade with in every part a script that would enable a particle effect on Touch and and disable it on TouchEnded. When I tried some parts in the blade didn't stop the melting effect. To conclude: using Touch events didn't seem like an option.

btw here is the script I used if interested:

local melt = script.Parent.MeltParticle

script.Parent.Touched:Connect(function(hit)
	if hit.Name ~= "Blade" then
		if hit.Material == Enum.Material.Concrete then
			melt.Enabled = true
		end
		if hit.Material == Enum.Material.Air then
			melt.Enabled = false
		end
	end
end)

script.Parent.TouchEnded:Connect(function(hit)
	if hit.Name ~= "Blade" then
		melt.Enabled = false
	end
end)

Does anyone know how they did that in those games?

2 comments

0

you could try unionasync to make it actually cut a hole into the surface instead of just leaving a decal. Just a suggestion though.

0

Yeah thx for the suggestion. however I wasn't planning on making decals. I wanted it to be dynamic

1 answer

✓ Accepted answer

Instead of .Touched use raycast instead, this also should be done in the client side, since this is just visual i doubt it will matter if other player see it, and that it would be very tasking on the server

You can create a ray that ignores the lightsaber, and starts from the tip of the lightsaber handle and end at the tip of the lightsaber (making the ray longer than the blade is also fine)

Also create the rays every RenderSteps or FPS

Then when the ray detects a part, create small circle object on where the ray hits.

If you don't know how to work with raycast, there are plenty of tutorials online

1 comment

0

Thx, I will try the raycasting

This discussion is preserved as it was. New answers, comments, and votes are closed.