Damage based on collision velocity?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? A system that can be used so that once an object hits you ex a part of a broken window with enuf speed, You will die

  2. What is the issue? It can be exploited by jumping into the roof, Then youll die and you cannon jump on slanted surfaces

local plr = game.Players:GetPlayerFromCharacter(script.Parent)
local character = plr.Character
print("WORKING")
for _,v in pairs(character:GetChildren()) do
	if v:IsA("Part") then
		v.Touched:Connect(function(t)
			--local kinetic = t.Mass/16 * ((v.Velocity-t.Velocity).Magnitude/4)^2
			--print(((v.Velocity-t.Velocity).Magnitude/4)^2)
			--print(t.Mass/16 * ((v.Velocity-t.Velocity).Magnitude/4)^2)
			print(v.Mass/16 * ((v.Velocity-t.Velocity).Magnitude/4)^2)
			if  (t.Mass/16 * ((v.Velocity-t.Velocity).Magnitude/4)^2) >= 196 and not (t.Anchored) then
				character:BreakJoints()
			elseif  (v.Mass/16 * ((v.Velocity-t.Velocity).Magnitude/4)^2) >= 75 then
				for _,v in pairs(character:GetChildren()) do
					character:BreakJoints()
				end
			end
		end)
	end
end

You should make it so that a part is “safe” until it goes faster than a certain speed, then it gets set to safe again once it goes below that speed.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.