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?
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
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