I need some help, how and what’s the best way of making destructive buildings? where you slam into things and destroy buildings without causing major performance issues and doing it efficiently.
You could do it so that when it hits a player, it unanchors all the bricks. That would mean something along the lines of
local brick = script.parent
script.Parent.Touched:connect(function(hit)
if hit and hit.Parent and hit.Parent:FindFirstChild(“Humanoid”) then
brick.Anchored = false
I honestly don’t really know. I’m not the best at scripting…
I tried doing a script like this, however I didn’t know how to reduce the mass of the parts.
https://gyazo.com/7b17418f697661538d2b81efdd195dad
for _, Inst in pairs(BuildStack) do
if Inst:IsA("BasePart") then
Inst.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
Inst.Anchored = false
end
end)
end
end
As seen in the video, the blocks seem way too heavy.
I checked the “Massless” property, however it would be better if it could be lighter.
Try:
for _, Inst in pairs(BuildStack) do
if Inst:IsA("BasePart") then
Inst.Touched:Connect(function(Hit)
if Hit.Parent:FindFirstChild("Humanoid") then
for _ , Inst in pairs(BuildStack) do
Inst.Anchored = false
end
end
end)
end
end
This iterates over all parts when touched.
Hope this helps!
Someperson576