I am working on a simple concept for a game where its the classic floor is lava, or the lava rises and you must go higher up to avoid it.
How can I achieve a system in which the rising lava will make the building(s) in the maps collapse?
I have thought about having them be unanchored and welded, but how would I be able to make it so that the lava can cause the weld or something to be broken off, making the pieces of the building collapse or fall or break.
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit:IsA('Part') and not (hit.Parent:FindFirstChild('Humanoid')) then --you may need to add other checks to confirm the object that gets hit is part of a building.
hit.Anchored = false
if hit:FindFirstChild('Weld') then
hit:FindFirstChild('Weld'):Destroy()
end
end)
script.Parent.Touched:Connect(function(hit)
if hit and hit.Parent and hit:IsA('Part') and not (hit.Parent:FindFirstChild('Humanoid')) then --you may need to add other checks to confirm the object that gets hit is part of a building.
hit.Anchored = false
for _, weld in ipairs(hit:GetDescendants()) do
if weld:IsA("Weld") == false then continue end
weld:Destroy()
end
end
end)