So I am trying to make a deadly Leaser Beam that destroys everything in its way though I am having a issue with terrain because when you try to set its parent it errors. My issue is that when the Laser Beam hits the terrain a explosion never spawns, and I am sure of that as I tested that when the Laser Beam hits the Terrain it never prints anything if I add a print. Also occasionally for some reason it says it cannot change Terrain's parent even though I have a filter so it will never change Terrain's parent, my Theory behind that is its just too much lag. Here is my script:
script.Parent.Activated:Connect(function()
if script.Parent.Parent.Name ~= "Gooncreeper" then
script.Parent:Destroy()
elseif script.Parent.Parent.Parent.Name ~= "Gooncreeper" and script.Parent.Parent.Name == "Backpack" then
script.Parent:Destroy()
end
ToolLocation = script.Parent
script.Parent = game.Lighting
ToolLocation:Destroy()
game.Lighting.DEATHBEAM.Parent = game.Workspace
Message = Instance.new("Message", game.Workspace)
for i = 1, 10 do
Message.Text = "World Destruction In: ".. 10 - i
wait(1.5)
end
PartLength = 0
Message:Destroy()
repeat
game.Workspace.DEATHBEAM.BEAM.Size = game.Workspace.DEATHBEAM.BEAM.Size + Vector3.new(5,0,0)
PartLength = PartLength + 5
game.Workspace.DEATHBEAM.BEAM.Position = game.Workspace.DEATHBEAM.BEAM.Position + Vector3.new(-2.5,-2.25,0)
wait(0.01)
PartsTouchingBeam = game.Workspace.DEATHBEAM.BEAM:GetTouchingParts()
for i, v in pairs(PartsTouchingBeam) do
if PartsTouchingBeam[i] ~= game.Workspace.DEATHBEAM.Part then
if PartsTouchingBeam[i].Name ~= workspace.Terrain then
PartsTouchingBeam[i]:Destroy()
else
ExplodeTerrain = Instance.new("Explosion")
ExplodeTerrain.Position = PartsTouchingBeam[i].Position
ExplodeTerrain.Visible = false
ExplodeTerrain.Parent = game.Workspace
ExplodeTerrain:Destroy()
end
end
end
until PartLength == 10000
end)

1 comment
Terrain can't explode. It's that simple. Nothing you do will ever change that as of now. You can only make it look like the terrain exploded.