EDIT: Problem solved. Don't answer to this question.

Hello! I'm trying to script a trail into my sword and I'm struggling to make it so that the trail will have its WidthScale reduced over time. My goal is to make it 0.1 and then remove the trail after some time that the animation of the Attack has been done.

So far, though, it doesn't seem to be working. I'd be glad to receive some help! Thanks ahead.

function Attack()
	Damage = DamageValues.SlashDamage
	Sounds.Slash:Play()
	script.Parent.Handle.Trail.Enabled = true
	script.Parent.Handle.PointLight.Enabled = true
	script.Parent.Handle.ParticleEmitter.Enabled = true

	if Humanoid then
		if Humanoid.RigType == Enum.HumanoidRigType.R6 then
			local Anim = Instance.new("StringValue")
			Anim.Name = "toolanim"
			Anim.Value = "Slash"
			Anim.Parent = Tool
		elseif Humanoid.RigType == Enum.HumanoidRigType.R15 then
			local Anim = Tool:FindFirstChild("R15Slash")
			if Anim then
				local Track = Humanoid:LoadAnimation(Anim)
				Track:Play(0)
				wait(Track.Length)
				wait(2.0)
while true do
	workspace.ClassicSword.Handle.Trail = NumberSequence.new(1,0.1)
	wait(0.1)
end
				script.Parent.Handle.Trail.Enabled = false
				script.Parent.Handle.PointLight.Enabled = false
				script.Parent.Handle.ParticleEmitter.Enabled = false
			end
		end
	end	
end

1 comment

0

I've been trying to use loops as well, but it doesn't seem to be working.