I have two script's that explode a model and another script that moves my rocket model it works just fine but it stops working when I use it for a second time here are my scripts:
(Script 1)
local rocket = game.ReplicatedStorage.Rocket
local button = game.Workspace.VipButtonRocket
local cannonC = game.ReplicatedStorage.RocketShooter:Clone()
local happyhome = game.ReplicatedStorage.HappyHome:Clone()
local house = game.Workspace.HappyHome
local canBoom = true
local function boom(otherPart)
wait(6)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA('Humanoid')
if humanoid and canBoom then
canBoom = false
for num, child in pairs(house:GetChildren()) do
if child:IsA('Part') then
local explosion = Instance.new('Explosion')
explosion.Parent = game.Workspace
child.Anchored = false
explosion.Position = child.Position
end
end
wait(3)
canBoom = true
end
end
button.Touched:Connect(boom)
wait(24)
happyhome.Parent = game.Workspace
happyhome:MoveTo(Vector3.new(1176, 51.4, 46))
cannonC.Parent = game.Workspace
cannonC:MoveTo(Vector3.new(1180, 39.5, 327))
game.Workspace.HappyHome:Destroy()
button.Parent = game.Workspace
button.Transparency = 0
This script Explodes my model
(Script 2)
local rocket = game.ReplicatedStorage.Rocket
local button = game.Workspace.VipButtonRocket
local cannon = game.ReplicatedStorage.RocketShooter
local RCopy = rocket:Clone()
local CCopy = cannon:Clone()
local happyhome = game.ReplicatedStorage.HappyHome:Clone()
button.Touched:Connect(function()
RCopy.Anchored = true
button.Transparency = 1
button.CanCollide = false
button.Parent = game.Lighting
CCopy.Parent = game.Workspace
RCopy.Parent = game.Workspace
wait(5.5)
end)
while wait(.001) do
RCopy.CFrame = RCopy.CFrame + Vector3.new(0, 0, -1)
if RCopy.Position.Z < 96 then
RCopy.Parent = game.Lighting
CCopy.Parent = game.Lighting
end
end
This script moves my rocket model and is supposed to respawn my models,Thanks.
