BodyVelocity not working

Ok, Good luck my good fellow… :slight_smile:

I’m using tween to make the magma model get bigger and then smaller all the time. it’s just an effect and i use a “for” loop because there are three parts in the model and i want to do the effect to all the parts

Hope this video helps you to understand

Actually i want to make the effect for every part in a different time but i don’t know how i can do that, probably making 3 tweens…

Why in the maxforce you aren’t using (math.huge) ?

1 Like

also i’m gonna be afk, but keep trying… i’ll be right back

1 Like

I’m back. I don’t know why the vfx keeps separating, it’s all welded together to the primary part.

i think we need to find a way to use LinearVelocity in a model instead of using primary part…

And this is what happens with your code:

1 Like

Maybe making the Orientation of the parts stay the same all the time with CFrame.Angles will solve it?

1 Like

Oh wait, Maybe LinearVelocity moves and rotates the parts too.

1 Like

Also, modify the line of the MagmaModel:PivotTo() to MagmaModel:PivotTo(HumanoidRootPart.CFrame * CFrame.new(0,3,-10) * CFrame.Angles(0,math.rad(90),0))

So it’s orientation is right

1 Like

You want it to look right??? Dang it says I’ve replied 21% of the messages. I will edit this message from now on.
Here’s the current script:


-- // Variables \\ --

local RemoteEvent = script.Parent

local TweenService = game:GetService("TweenService")

local Debris = game:GetService("Debris")

local Debounce = false

RemoteEvent.OnServerEvent:Connect(function(player, AbilityModule)
	
	-- // More variables...
	
	local Character = player.Character
	
	local Humanoid = Character:FindFirstChild("Humanoid")
	
	local HumanoidRootPart = Character:FindFirstChild("HumanoidRootPart")
	
	---------------------------------------------
	
	-- // Functionality \\ --
	
	if Debounce == false then
		
		local MagmaModel = script.Parent.VFX.FistVFX:Clone()
		MagmaModel.Parent = game.Workspace
		--MagmaModel:PivotTo(HumanoidRootPart.CFrame * CFrame.new(0,3,-10) * CFrame.Angles(0,0,0))
		MagmaModel:PivotTo(HumanoidRootPart.CFrame * CFrame.new(0,3,-10))

		local MagmaModelChildrens = MagmaModel:GetChildren()	

		local TweenInfo1 = TweenInfo.new(
			0.5,
			Enum.EasingStyle.Quad,
			Enum.EasingDirection.InOut,
			0,
			false,
			0
		)

		for i,v in pairs(MagmaModelChildrens) do
			if v:IsA("BasePart") then

				local Goal = {
					Size = v.Size + Vector3.new(0.5,0.5,0.5)
				}			
				local TweenSizeAnimation = TweenService:Create(v,TweenInfo1,Goal)
				TweenSizeAnimation:Play()
			end
		end
				
		local Attachment = Instance.new("Attachment")
		Attachment.Parent = MagmaModel.PrimaryPart

		local LinearVelocity = Instance.new("LinearVelocity")
		LinearVelocity.VectorVelocity = HumanoidRootPart.CFrame.LookVector * 100
		LinearVelocity.MaxForce = math.huge
		LinearVelocity.Attachment0 = Attachment
		LinearVelocity.Parent = Attachment
		
		local debris = game:GetService("Debris")
		--debris:AddItem(MagmaModel,10)
	end
end)

VFX.rbxl (141.2 KB)

I’m going to take a break. I’ll respond asap.

1 Like

Ok, no problem take your time, i’ll search for solutions

1 Like

Okay back did you find any solutions so far?

1 Like

Looking at this video again of the lag, i believe it is running the tween before you are instancing the part, try to move the tween code to after the instancing.

So, instance the part, then run the bodyvelocity, then run the tween.

1 Like

Sadly, i didn’t found any one…

1 Like

I did that in the code, read it again

1 Like

You’re right you changed it already, i was looking at the first code.

And that didn’t rid the lag when you were using bodyvelocity?

1 Like

It wasn’t the lag it was the tween. Whenever the tween plays it stops the velocity.

1 Like