I attempted to make a fall damage script that uses velocity, but it is not damaging the player. I took part of the script that i was making, so that its easier to understand. So what happens in the full script, if "opponent" touches the arm of the player, it gets flung into the air, and frozen in the air. Then the script makes the "opponent" to get flown back to the ground with a upVector Velocity of multiplied by -85.
Baseplate = game.Workspace.Baseplate
replicatedstorage = game:GetService("ReplicatedStorage")
RicoClass = replicatedstorage.RicoClass
tool = script.Parent.Parent
cooldown = false
Dash = RicoClass:FindFirstChild("Dash")
debounce = true
Dash.OnServerEvent:connect(function(player)
local hand = player.Character.RightLowerArm
---------------------------------------
-------------[Grab]--------------------
hand.Touched:connect(function(hit)
local opponent = hit.Parent:findFirstChild("Humanoid") or hit.Parent.Parent:FindFirstChild("Humanoid")
if not debounce then return end
debounce = false
debounce = {};
if opponent and opponent ~= player.Character:findFirstChild("Humanoid") then
if debounce[opponent] then return end;
debounce[opponent] = true;
local bv = Instance.new("BodyVelocity", opponent.Parent.Torso)
local bv1 = Instance.new("BodyVelocity", player.Character.UpperTorso)
local function Touch(hit) --- fall damage here
if not debounce then return end
debounce = false
if bv.Velocity == opponent.Parent.Torso.CFrame.upVector * -85 and hit == Baseplate then
bv:remove()
opponent:TakeDmg(25)
end
end
bv.MaxForce = Vector3.new(1e8,1e8,1e8)
bv1.MaxForce = Vector3.new(1e8,1e8,1e8)
bv.Velocity = opponent.Parent.Torso.CFrame.upVector * 50
bv1.Velocity = player.Character.UpperTorso.CFrame.upVector * 50
wait(0.4)
bv.Velocity = opponent.Parent.Torso.CFrame.upVector * 0
bv1.Velocity = player.Character.UpperTorso.CFrame.upVector * 0
wait(0.35)
bv.Velocity = opponent.Parent.Torso.CFrame.upVector * -85
Touch(hit)
end
end)
end)
