Im trying to make a building game where the welds would break if it falls how would i be able to do this
What do you mean? Do you want the welds to break if it exceeds force, like pulling, wanting the connection to snap? Or, do you want welds to break when it falls from a far enough distance?
How would i make both of them (char limit)
well, if you want to make a weld destroy if the parent part get touched by a force,
you can try to detect with Touched event if a part with any velocity instance has a x force
like
local x = 100 --this is the Velocity speed, this means the higher, the faster the collider should be
part.Touched:Connect(function(other) --lets detect if the collider part has a velocity instance
if other:FindFirstChild("LinearVelocity") and other:FindFirstChild("LinearVelocity").LineVelocity >= x then
weld:Destroy() --destroy the weld
end
end
i wrote this on mobile so maybe i wrote wrong, but is very simple
Im looking for something like the crash system in car crushers 2
You can track the motion of a part using AssemblyLinearVelocity
and AssemblyAngularVelocity
. They are properties that, quite literally, show you the current motion of a part, position or rotation wise.
Here is an example. For this test, you can predetermine the part’s spot high in the sky, so it can drop onto the baseplate and see if it detects a high impact.
local part = workspace.Part
part.Touched:Connect(function(otherPart)
velocity = part.AssemblyLinearVelocity.Magnitude
if velocity >= 50 then
print("high impact")
elseif velocity > 1 and velocity < 50 then
print("low impact")
end
end)
You can obviously change the amount of force needed to trigger this high impact.