How would I make a model fling

Hi, I’m currently making a Vehicle Turret fling thing when explodes like this:

Screenshot 2024-01-01 153646

Screenshot 2024-01-01 153501

So basically what I want to do is make this Model fling up:

Screenshot 2024-01-01 153215

I have tried using this but it won’t work for some reason:

			local VehicleTurret = VehicleMainParts.VehicleTurret:GetChildren()
			VehicleTurret.Material = Enum.Material.Sandstone
			VehicleTurret.BrickColor = BrickColor.new("Dark stone grey")
			VehicleTurret.Anchored = false
			VehicleTurret.CanCollide = false
			VehicleTurret.Parent = workspace
			VehicleTurret.Velocity = VehicleTurret.Velocity+Vector3.new(math.random(-25,25),math.random(25,50),math.random(-25,25))
			VehicleTurret.RotVelocity = VehicleTurret.RotVelocity+Vector3.new(math.random(-10,10),math.random(10,10),math.random(-10,10))
			print("Turret Disabled")
1 Like

The velocity you are applying to the Turret could be so weak that it doesn’t fling, you can increase the velocity you are going to apply to the turret higher.

local VehicleTurret = VehicleMainParts.VehicleTurret:GetChildren()
			VehicleTurret.Material = Enum.Material.Sandstone
			VehicleTurret.BrickColor = BrickColor.new("Dark stone grey")
			VehicleTurret.Anchored = false
			VehicleTurret.CanCollide = false
			VehicleTurret.Parent = workspace
			VehicleTurret.Velocity = VehicleTurret.Velocity+Vector3.new(math.random(-25,25),math.random(25,50),math.random(-25,25)) * 100
			VehicleTurret.RotVelocity = VehicleTurret.RotVelocity+Vector3.new(math.random(-10,10),math.random(10,10),math.random(-10,10)) * 100
			print("Turret Disabled")

In this script, I multiplied the velocity you were gonna add to the turret as 100, hope it works

Also I saw that

local VehicleTurret = VehicleMainParts.VehicleTurret:GetChildren()

And you tried to change properties of the table, ( :GetChildren() returns table of Children Instances )
Instead of this, you should do

local VehicleTurret = VehicleMainParts.VehicleTurret:GetChildren()
for i, v in pairs(VehicleTurret) do
    if v:IsA('BasePart') then
			v.Material = Enum.Material.Sandstone
			v.BrickColor = BrickColor.new("Dark stone grey")
			v.Anchored = false
			v.CanCollide = false
			v.Parent = workspace
			v.Velocity = v.Velocity+Vector3.new(math.random(-25,25),math.random(25,50),math.random(-25,25)) * 100
			v.RotVelocity = v.RotVelocity+Vector3.new(math.random(-10,10),math.random(10,10),math.random(-10,10)) * 100
			print("Turret Disabled")
    end
end

You should use for Loops to assign properties of childrens of a Instance.

1 Like

Do not use a random velocity, instead I suggest getting the CFrame of (the middle of) the turret , then using the lookVector, upVector or rightVector for the upwards fling direction, this purely depends on how your model is rotated.

Then just add a tiny bit of random velocity and you’re finished.

Also I highly suggest that you keep the VehicleTurret welded and only put a high velocity & rotVelocity on one part, the center.
Else what will happen is the same as what current is going on: there will be forces working against eachother.

You can also make the force a lot stronger so that it works.

Finally I believe you might be forgetting to delete the weld which connects the base to the turret, you have to destroy this for the turret to pop off the base.

Worked but it’s now dragging every part of the Tank and it went to the sky

Yeah I already disabled the Welds

Theres no Weld but it’s still connected

disable any welds or joints between main tank and turret when turret is getting flinged

Worked but by any chance do you also know how to make it fling up only

v.Velocity = v.Velocity+Vector3.new(math.random(-25,25),math.random(25,50),math.random(-25,25)) * 100

This is a line of code from the solution post, and you can edit it to make parts only go up.
To do this, you should edit X and Z velocity.

v.Velocity = v.Velocity+Vector3.new(0,math.random(25,50),0) * 100

This makes the parts only go up. you can adjust it by editting X and Z velocity

Alright. And also thanks for the help!

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