local Root = script.Parent:WaitForChild("Torso")
local BeforeMagnitude = 0
game:GetService("RunService").Heartbeat:Connect(function()
local Magnitude = Root.Velocity.Magnitude
local SubtractedMagnitude = (BeforeMagnitude-Magnitude)
if SubtractedMagnitude>=16 and not Root:HasTag("db") and Root.Parent:FindFirstChildWhichIsA("Humanoid").Health>0 then
Root:AddTag("db")
script.Parent:FindFirstChildWhichIsA("Humanoid").Health-=Magnitude
warn("Fall Detected, Damaging by "..Magnitude)
spawn(function()
wait(1)
Root:RemoveTag("db")
end)
end
BeforeMagnitude = Magnitude
end)
Useally it works pretty well when it does detect, but sometimes it just doesn’t detect. I need some help to find out why so that I can fix my script.