Drop Anim/Floor Hit Anim

Hi, for everyone who reads this would be nice if you help me
so i just have a question on how to do this because i already searched on Youtube and i could not find something.

Is there a way to make it like if a player drops from 50 studs he plays a animation if he hits the ground?

idk if this is possible but would be nice if you help me.
Have a Great Day :smiley:

3 Likes

Hope this helps: How to detect when a player has fell a certain amount of studs Mid-Air? - #4 by DouglasRastelli
Try using that in a script and have it run on an if statement.

2 Likes

Local script in startercharacterscripts:

local char = script.Parent
local hum = char:WaitForChild("Humanoid")

local falling = false
local startpos = nil

while true do
	wait()
	if hum.FloorMaterial == Enum.Material.Air and falling == false then
		falling = true
		local fallpos = nil
		startpos = char.HumanoidRootPart.Position
		repeat
			wait()
			if char.HumanoidRootPart then
				fallpos = char.HumanoidRootPart.Position
			end
		until
		hum.FloorMaterial ~= Enum.Material.Air
		falling = false
		if fallpos ~= nil and startpos ~= nil then
			print((Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude .. "studs fell")
			if (Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude >= 50 then
				-- ur animation script
			end
		end
	end
end

simple way

5 Likes

This should also work, good job @appe125!

2 Likes

thanks! i randomly found that floormaterial thing lol

3 Likes

well i am probably kinda lost right now but what should i type as the “animation script”
i am not sure but maybe you can give me an example

1 Like

just a minute i will write something

3 Likes

This could help: Scripting Avatar Animations | Roblox Creator Documentation

1 Like

ok so copy these to startercharacterscripts:
image
and to the script copy this:

local char = script.Parent
local hum = char:WaitForChild("Humanoid")
local animations = char:WaitForChild("Animations")
local animation = char.Animations.FallAnimation

local animplayer = hum:LoadAnimation(animation)

local falling = false
local startpos = nil

while true do
	wait()
	if hum.FloorMaterial == Enum.Material.Air and falling == false then
		falling = true
		local fallpos = nil
		startpos = char.HumanoidRootPart.Position
		repeat
			wait()
			if char.HumanoidRootPart then
				fallpos = char.HumanoidRootPart.Position
			end
		until
		hum.FloorMaterial ~= Enum.Material.Air
		falling = false
		if fallpos ~= nil and startpos ~= nil then
			print((Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude .. "studs fell")
			if (Vector3.new(0,fallpos.Y,0) - Vector3.new(0,startpos.Y,0)).Magnitude >= 50 and hum then
				animplayer:Play()
				hum.WalkSpeed = 0
				hum.JumpPower = 0
				wait(1)
				hum.WalkSpeed = 16 --normal walkspeed
				hum.JumpPower = 50 --normal jumppower
			end
		end
	end
end

change FallAnimations AnimationId to the animation u want

2 Likes

then try to jump from high place :slight_smile:
tell me if it works

yep works ty so much dude
Have a nice day :smiley:

2 Likes

oh wait just one quick question is there a way to make it so the animation plays longer
like right now i just hit the ground and it plays the animation for around idk 0.5 second

no problem mate have fun. can u mark it to solved cuz im starteer and i want to grind some

yes u can slow it down with animplayer:AdjustSpeed(0.5)

You’d have to make the animation longer in the animation plugin.

Or you could do that, that will also work.

it depends do u want it longer, or slower

1 Like

ok so probably you got me wrong or i am bad at explaining but i mean this:

did you make the animation urself

yep i did the animation by myself