Hi so im with a problem im trying to make like an animation if the player jumped on the edge of a plataform, But it makes the animation inside the center of the plataform i dont know why! heres the code

local Humanoid = script.Parent:WaitForChild("Humanoid")
local RootPart = script.Parent:WaitForChild("HumanoidRootPart")

local Animation = Humanoid:LoadAnimation(game.ReplicatedStorage.Animations["Edge Jumping"])

while true do
	wait()
	local Part = game.Workspace:FindPartOnRayWithIgnoreList(Ray.new(RootPart.CFrame.p,Vector3.new(0,-5,0)),{script.Parent})
	if Part then
		local PositivesX = (Part.Position.X + Part.Size.X / 2) - 9
		local NegativesX = (Part.Position.X - Part.Size.X / 2) + 9
		local PositivesZ = (Part.Position.Z + Part.Size.Z / 2) - 9
		local NegativesZ = (Part.Position.Z - Part.Size.Z / 2) + 9
		
		local Y = Part.Position.Y + Part.Size.Y / 2 -3
		
		
		if Humanoid.Jump == true and RootPart.Position.Y > Part.Size.Y then
			
			
			 if RootPart.Position.X > PositivesX then
				Animation:Play()
				print("Higher than X pos")
			elseif RootPart.Position.X < NegativesX then
								print("Lower than X pos")
				Animation:Play()	
			end
			
			if RootPart.Position.Z > PositivesZ then
				print("Higher than Z pos")
				Animation:Play()
			elseif RootPart.Position.Z < NegativesZ then
				print("Lower than Z pos")
				Animation:Play()
			end
		end
		
	end
end