Tween destroying parts

Hello!
I have this super annoying issue, where every time a tween to a part happens the part goes downwards (-y).
It’s not collision because I have a collision group that makes it not collide.

EDIT: My parts are unanchored and not welded to anything.

Here is my script that includes tweens:

local Debounce = false
local TornadoStarter = game.Workspace.TornadoStarter
local build = script.Parent
local TS = game:GetService("TweenService")
local MusicAndSounds = game.Workspace.MusicAndSounds
local Debounce2 = false
local Debounce3 = false


local function detectTouch(otherPart)
	if otherPart and otherPart:IsA("Part") then
		if otherPart.Name ~= "Handle" and otherPart.Name ~= "FloorBase" then
			if otherPart.Anchored == false then
				if not Debounce2 then
					otherPart.AssemblyLinearVelocity = Vector3.new(math.random(-65, 65),130,math.random(-60, 60))

					for _,v in ipairs(otherPart:GetChildren()) do
						if v then
							if (v:IsA("Weld") or v:IsA("WeldConstraint")) then
								v:Destroy()
							end
						end
					end
					wait(0.5)

					otherPart.AssemblyLinearVelocity = Vector3.new(0,0,0)
				end
			end	
		end
	end
end

local function getRandomPosition()
	local Dirs = game.Workspace.WaterspoutDirections:GetChildren()
	local rInd = math.random(1, #Dirs)
	local rDir = Dirs[rInd]

	return rDir.Position
end

local function getStuff()
	while Debounce do
		if build.Parent == game.Workspace.ShownMaps then
			-- Replace this with the actual parts you want to modify
			local part1 = TornadoStarter.Particle
			local part2 = TornadoStarter.Hitbox
			local randomPosition = getRandomPosition()

			local tI = TweenInfo.new(
				8, -- Duration
				Enum.EasingStyle.Linear,
				Enum.EasingDirection.Out,
				0, -- Repeat count (0 for no repeat)
				false, -- Reverses (false for no reverse)
				0.1 -- Delay between repeats
			)

			-- Create a new Tween for the part's Position property
			local tween1 = TS:Create(part1, tI, {Position = randomPosition})
			local tween2 = TS:Create(part2, tI, {Position = randomPosition})
			-- Play the Tween
			tween1:Play()
			tween2:Play()


			-- Connect to the completed event to reset Debounce
			wait(8)
		end
	end
end

local function StartTornado()
	game.Lighting.Brightness = 1
	game.Lighting.FogEnd = 200
	game.Lighting.FogColor = Color3.new(0.521599, 0.599084, 0.660639)
	game.Workspace.Cloud.Transparency = 0
	MusicAndSounds.Tornado:Play()

	TornadoStarter.Particle.ParticleEmitter.Enabled = true

	TornadoStarter.Particle.Anchored = false
	TornadoStarter.Hitbox.Anchored = false


	getStuff()
end

local function ConnectToTornado()
	local TornadoEvent = game.ReplicatedStorage.SelectedDisasters:FindFirstChild("Tornado")
	local WindChaosEvent = game.ReplicatedStorage.SelectedDisasters:FindFirstChild("Wind Chaos")
	if (TornadoEvent and TornadoEvent:IsA("RemoteEvent")) or (WindChaosEvent and WindChaosEvent:IsA("RemoteEvent")) then
		if script.Parent.Parent == game.Workspace.ShownMaps then
			if not Debounce then
				Debounce = true
				StartTornado()
			end
		end
	end
end




game["Run Service"].Heartbeat:Connect(function()
	ConnectToTornado()
end)


TornadoStarter.Hitbox.Touched:Connect(detectTouch)

Any help appreciated!

1 Like

You’re not setting the Anchored property of otherPart back to true after applying the AssemblyLinearVelocity. If you don’t anchor the part after it is moved, it will obey the physics and fall due to gravity, which is possibly why it’s moving downward.

Try setting the Anchored property to true after these lines:

wait(0.5)
otherPart.AssemblyLinearVelocity = Vector3.new(0,0,0)
otherPart.Anchored = true

This should prevent your parts from falling down. Just be careful with this approach since you might face some other issues when trying to tween unanchored parts.

Also! Make sure the values you are giving to the vectors in the AssemblyLinearVelocity property are correct and that the local Y direction is positive. But if your issue will still be there, double check the positions to which you’re tweening your parts. It might be that they are at a negative Y coordinate.