How can I make the parts unanchored and fly out by themselves?

I wrote a simple script that will explode a part, which is to add the explosion to one part, and PartA, PartB, PartC and PartD are going to move to a special folder and become Un-anchored.

The problem is that Parts A, B, C, D etc. don’t fall down. N**o error pops up on the output.**And how can I make the parts fly out more “spectacularly” than just wait for someone to push them?

Script
local click = script.Parent.ClickDetector
local clicked = true

click.MouseClick:Connect(function()
	if clicked == true then
		click.Parent.BrickColor = BrickColor.new("Really red")
		local explosion = Instance.new("Explosion")
		explosion.BlastRadius = 10
		explosion.Position = Vector3.new(94.19, 93.219, 4.013)
		explosion.Parent = game.Workspace.Model.Explode
		game.Workspace.Model.Explode.explode1:Play()
		
		local PartA = game.Workspace.Model.PartA
		PartA.Parent = game.Workspace.FallenParts
		PartA.Anchored = false
		
		local PartB = game.Workspace.Model.PartB
		PartB.Parent = game.Workspace.FallenParts
		PartB.Anchored = false
		
		local PartC = game.Workspace.Model.PartC
		PartC.Parent = game.Workspace.FallenParts
		PartC.Anchored = false
		
		local PartD = game.Workspace.Model.PartD
		PartD.Parent = game.Workspace.FallenParts
		PartD.Anchored = false
		
		clicked = false
		click.Parent.Click:Play()
		wait(2)
		click.Parent.BrickColor = BrickColor.new("Lime green")
		clicked = true
	end
	
	
end)

So far, I watched a few posts on DevForum on this topic and added “local” to each part. But why doesn’t that work?

2 Likes

Do the parts change color? If not, then the problem is that the MouseClick function doesn’t run. Make sure this is a server script and not a local script

1 Like

I recommand using tween service for it.

1 Like

Everything except falling blocks works.

What type of script is it? Local or server script? Local scripts don’t run in the workspace, and they wouldn’t be able to change the anchored value

It’s a server script.If I free up some memory on my computer, maybe I’ll send a screen recording.

Vimeo Link to the video

1 Like

Maybe the parts do get unanchored, you just can’t see it because there’s no force that would push it to move. To move parts like an explosion, I would recommend you use a VectorForce. Here’s a video by B Ricey about vector forces, I highly recommend watching it, and I think you will be able to write your own script after that. But let me know if it didn’t help, and ill try to make the script

Here Script for making all objects fall also I upgrade your script for more easily use in the future

local click = script.Parent.ClickDetector
local clicked = true
local Target = game.Workspace.Tower --SelectTargetHere
local BombTarget = Target.Explode

click.MouseClick:Connect(function()
	if clicked == true then

		for i ,Child in pairs(Target:GetChildren()) do
			Child.Anchored = false
		end

 wait(0.5)
		click.Parent.BrickColor = BrickColor.new("Really red")
		local explosion = Instance.new("Explosion")
		explosion.BlastRadius = 10
  explosion.BlastPressure = 5000000
		explosion.Position = BombTarget.Position
		explosion.Parent = Target.Explode



		
		clicked = false
		wait(2)
		click.Parent.BrickColor = BrickColor.new("Lime green")
		clicked = true
	end


end)