Player floating in animations

Hey fellow developers!

  1. What do you want to achieve? I want the player to appear under objects instead of floating towards them.

  2. What is the issue? Whenever a player goes under an object with the crawl or crouch animation he gets pulled up towards that object
    Knipsel

  3. What solutions have you tried so far? I’ve tried looking for solutions on the developers hub or the forum to see if people had the same issues but didn’t seem to find any.

The player you see in the image is not on an object but is just floating, collisions are turned on for the lowerlegs and lower and upper torso. HumanoidStateType.Climbing is false, please see the animation script below:

local ismobile = game:GetService("UserInputService").TouchEnabled

if ismobile then
	script.Disabled = true
end

Player = game.Players.LocalPlayer

repeat
	wait()
until Player.Character

 Mouser = Player:GetMouse()
 name = Player.Name
 char = game.Workspace[Player.Name]

local replicatedstorage = game:GetService("ReplicatedStorage")
local DisableAnimEvent = replicatedstorage:WaitForChild("DisableAnim")

local crouching = false
local crawling = false
local sprinting = false
local InputService = game:GetService("UserInputService")
local crouchbutton = script.Parent.Parent.Parent.StarterGui.Animations.Crouchbutton
local crawlbutton = script.Parent.Parent.Parent.StarterGui.Animations.Crawlbutton

local debounce = false

Animation = script.Anim
Crawlation = script.Crawl
Walkalation = script.WalkAnim

walktrack = char.Humanoid:LoadAnimation(Walkalation)
animtrack = char.Humanoid:LoadAnimation(Animation)
crawler = char.Humanoid:LoadAnimation(Crawlation)

char.Humanoid.WalkSpeed = 16 
crawler:Stop()
animtrack:Stop()



wait(.2)




Mouser.KeyDown:Connect(function(key)
	if key == "c" and crouching == false and crawling == false and sprinting == false then
	crouching = true
		for i = 1,2 do
			wait()
			char.Humanoid.CameraOffset = Vector3.new(0,-2,0)
		end
		
		animtrack:Play()
		
		animtrack:AdjustSpeed(0)
		char.Humanoid.WalkSpeed = 10
		local Event = char.Humanoid.Running:Connect(function(speed)
    if speed == 0 then
        animtrack:AdjustSpeed(0)
    else
        animtrack:AdjustSpeed(1)
			end
			while crouching == true do
				char.Humanoid.WalkSpeed = 10
				wait(0.2)
			end
		end)
	else
		if key == "c" and crouching == true and crawling == false and sprinting == false then
			char.Humanoid.WalkSpeed = 5
			
			for i = 1,2 do
				wait()
				char.Humanoid.CameraOffset = Vector3.new(0,-5,0)
			end
			crawler:Play()
			print("crawling")
			crawler:AdjustSpeed(0)
			animtrack:Stop()
			crawling = true
			crouching = false
			local Event = char.Humanoid.Running:Connect(function(speed)
			if speed == 0 then
				crawler:AdjustSpeed(0)
			else
				crawler:AdjustSpeed(1)
				end
				while crawling == true do
					char.Humanoid.WalkSpeed = 5
					wait(0.2)
				end
			end)
		else
			if key == "x" and crouching == true and crawling == false and sprinting == false then 
				crouching = false
				for i = 1,2 do
					wait()
					char.Humanoid.CameraOffset = Vector3.new(0,0,0)
				end
				animtrack:Stop()
				print("stand")
				char.Humanoid.WalkSpeed = 16 
			else
				if key == "x" and crouching == false and crawling == true and sprinting == false then
					
					crouching = true
					crawling = false
					for i = 1,2 do
						wait()
						char.Humanoid.CameraOffset = Vector3.new(0,-2,0)
					end
					crawler:Stop()
					animtrack:Play()
					print("crouch")
					animtrack:AdjustSpeed(0)
					char.Humanoid.WalkSpeed = 10
				end
				
			end
		end
	end
	
end)
while wait(1) do
	if (char.Humanoid:GetState() == Enum.HumanoidStateType.Freefall) then
		if crawling == true or crouching == true then
			char.Humanoid.WalkSpeed = 0
			print("fallin")
			wait(2)
		
		end		
	end
end